Skip to content

Commit 691ca90

Browse files
committed
Merge branch 'docu_library' into github_dev
2 parents ed89a70 + c56fb94 commit 691ca90

File tree

8 files changed

+196
-24
lines changed

8 files changed

+196
-24
lines changed

docs/Contributing/index.md

Lines changed: 108 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,112 @@ nav_order: 7
55
permalink: /contributing/
66
---
77

8-
show here that they can add their own projects into projects/ by pull request
9-
issues
8+
# Contributing
9+
{: .fs-8 .fw-500 .no_toc}
10+
---
11+
12+
Whether you're fixing bugs, adding new functionality, improving documentation, or creating your own projects, your contribution is highly valued and appreciated!
13+
{: .fw-500}
14+
15+
- TOC
16+
{:toc}
17+
18+
## Getting Started
19+
Before diving in, familiarize yourself with SensEdu:
20+
1. Read through this wiki
21+
2. Run basic examples and finished projects
22+
3. Explore existing [issues] and [roadmap]({%link Contributing/index.md %}#roadmap)
23+
24+
If you are still not sure, feel free to open a [discussion](https://github.com/ShiegeChan/SensEdu/discussions) and we'll find a job for you!
25+
26+
## How to Contribute
27+
28+
### Report Bugs
29+
Found a bug or unexpected behavior? Help us fix it:
30+
1. Search for existing [issue] to avoid duplicates
31+
2. Create a new [issue] with `bug` label, providing:
32+
1. Steps to reproduce
33+
2. Expected vs actual behaviour
34+
3. Screenshots, logs, oscilloscope waveforms or any additional data
35+
36+
### Suggest Features
37+
Have an idea for a new sensor driver, project or optimization?
38+
39+
1. Create an issue with the `enhancement` label:
40+
1. Descibe your idea in detail
41+
2. Provide some usage examples
42+
43+
### Improve Documentation
44+
Clear documentation is essential for our educational purposes, help us:
45+
* Fix typos or grammatical errors
46+
* Clarify ambiguous explanations to ensure everything is easy to understand
47+
* Fill in missing explanations
48+
49+
{: .warning}
50+
The documentation is targeted to beginner students as well. Try to avoid logical skips, use simple language and add diagrams, image or code examples!
51+
52+
### Improve Code
53+
54+
1. Review the [library wiki section]({% link Library/index.md %}) and [naming convention]({% link Contributing/index.md %}#library-contributions)
55+
2. Assign yourself an [issue] or [discussion]
56+
3. Create a Pull Request (PR) and ask for a review
57+
58+
{: .warning}
59+
Try to keep PRs small, focusing on one feature/fix
60+
61+
### Submit Project
62+
Created something amazing using SensEdu? Share it with us! Check [Project Submissions]({% link Contributing/index.md %}#project-submissions) for detailed instructions.
63+
64+
65+
## Library Contributions
66+
67+
Please follow naming convention used throught the code. Some of it described in [library main page]({% link Library/index.md %}). Be careful with usign new timers and dma streams, make sure they are free. Read through developers notes for each peripheral you want to modify.
68+
69+
If you are an experienced embedded systems developer, feel free to optimize library code for better performance.
70+
71+
{: .warning}
72+
Before pushing your library changes, make sure that **ALL** examples are working properly
73+
74+
75+
## Project Submissions
76+
77+
If you have developed any projects using our shield, please feel free to push it to `projects\your_project\` directory. Additional examples for usage are much appreciated even if they are quite similar to already developed projects.
78+
79+
If you are not sure, which project to develop there are some suggestions:
80+
* FSK (Frequency-Shift Keying) modulated communication between multiple boards
81+
* Radar speed gun
82+
* Weather station with barometric pressure sensor
83+
84+
85+
## Roadmap
86+
87+
- [x] DAC Channel 2 support
88+
- [x] Automatic buffer alignment for DAC
89+
- [x] Cache coherence issues with DAC
90+
- [x] ADC3 support
91+
- [ ] Automatic buffer alignment for ADC
92+
- [ ] Rewrite ADC sampling frequency calculations
93+
- [ ] Separate timers for each ADC and DAC channel
94+
- [ ] Ultrasonic measurements performance boost using DMA
95+
- [ ] XCorr calibration algorithm
96+
- [ ] Improved Arduino-MATLAB serial communication
97+
- [ ] SensEdu library barometric sensor support
98+
- [ ] Examples for barometric pressure usage
99+
- [ ] 2-3 Fully developed projects as SensEdu showcase
100+
101+
---
102+
103+
Thank You to All Contributors!
104+
{: .fw-500 .mb-1}
105+
106+
<ul class="list-style-none">
107+
{% for contributor in site.github.contributors %}
108+
<li class="d-inline-block mr-1">
109+
<a href="{{ contributor.html_url }}"><img src="{{ contributor.avatar_url }}" width="32" height="32" alt="{{ contributor.login }}"></a>
110+
</li>
111+
{% endfor %}
112+
</ul>
10113

11-
before pushing any changes in library, check every single related example to work properly
114+
[issue]: https://github.com/ShiegeChan/SensEdu/issues
115+
[issues]: https://github.com/ShiegeChan/SensEdu/issues
116+
[discussion]: https://github.com/ShiegeChan/SensEdu/discussions

docs/Library/ADC.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,30 @@ The STM32H747 features three 16-bit ADCs with up to 20 multiplexed channels each
2020

2121
## Errors
2222

23+
Main ADC error code is `0x20xx`. Find the way to display errors in your Arduino sketch [here]({% link Library/index.md %}#error-handling).
24+
25+
An overview of possible errors for ADC:
26+
27+
* `0x2000`: No Errors
28+
* `0x2001`: ADC was initialized before initialization
29+
* `0x2002`: Passed ADC instance is not either `ADC1`, `ADC2` nor `ADC3`
30+
* `0x2003`: ADC failed to disable
31+
* `0x2004`: ADC failed to power up
32+
* `0x2005`: Selected pin for ADC is not reachable. Refer to the [table]({% link Library/ADC.md %}#notes) to find proper pins for each ADC instance
33+
* `0x2006`: Unexpected pin number during initialization. Must be at least 1
34+
* `0x2007`: Unexpected address or memory size for DMA
35+
* `0x2008`: Unexpected sampling frequency. Must be at least 1kHz
36+
* `0x2009`: Software polling in `SENSEDU_ADC_MODE_ONE_SHOT` is currently broken. Use `SENSEDU_ADC_MODE_CONT` or `SENSEDU_ADC_MODE_CONT_TIM_TRIGGERED`. If you want to look into this and have a try fixing it, refer to [this issue]
37+
38+
An overview of critical errors. They shouldn't happen in normal user case and indicate some problems in library code:
39+
40+
* `0x20A0`: PLL configuration failed
41+
* `0x20A1`: Internal logic for channel selectrion failed
42+
* `0x20A1`: Internal logic for setting sample time failed
43+
* `0x20A2`: Operation mode selection accepted unexpected value. Should never happen, since all possible values of type `SENSEDU_ADC_CONVMODE` must be handled internally
44+
* `0x20A3`: Data management mode selection accepted unexpected value. Should never happen, since all possible values of type `SENSEDU_ADC_DMA` must be handled internally
45+
46+
2347
## Structs
2448

2549
### SensEdu_ADC_Settings

docs/Library/DAC.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ Each of the methods are usefull for different applications.
2929

3030
## Errors
3131

32+
Main DAC error code is `0x30xx`. Find the way to display errors in your Arduino sketch [here]({% link Library/index.md %}#error-handling).
33+
34+
An overview of possible errors for DAC:
35+
* `0x3000`:
36+
* `0x3001`:
37+
* `0x3002`:
38+
39+
An overview of critical errors. They shouldn't happen in normal user case and indicate some problems in library code:
40+
* `0x30A0`:
41+
* `0x30A1`:
42+
3243
## Structs
3344

3445
### SensEdu_DAC_Settings

docs/Library/Timers.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ Timers allow precise event scheduling, such as creating delays or setting sampli
1818

1919
## Errors
2020

21+
Main timers error code is `0x10xx`. Find the way to display errors in your Arduino sketch [here]({% link Library/index.md %}#error-handling).
22+
23+
An overview of possible errors for timers:
24+
* `0x1000`: No Errors
25+
* `0x1001`: Unexpected DAC frequency. Maximum possible is 60MHz, refer to [these calculations]({% link Library/Timers.md %}#frequency-settings) for more details
26+
2127
## Functions
2228

2329
### SensEdu_TIMER_DelayInit

docs/Projects/index.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,31 @@ nav_order: 5
55
permalink: /projects/
66
---
77

8-
# Projects
8+
# Projects with SensEdu shield and Arduino GIGA R1 platform using SensEdu Library
99
{: .fs-8 .fw-500}
1010
---
1111

12-
(short description)
12+
The following is the documentation of some of the projects already done by the developers of the board and the library. These projects aim to show how to use
13+
the board shield with Arduino GIGA R1 platform, and at the same time utilize the custom SensEdu Library.
14+
15+
{: .note}
16+
The SensEdu Library is *NOT* dependent on the SensEdu Board and Arduino GIGA platform, rather on the microcontroller of the platform you are using.
17+
18+
As per the documentation for the board (insert link), the shield is mainly used as a tranciever utilizing the speakers and the microphones on the board.
19+
Therefore, some of the project ideas are:
20+
* ultrasound distance measurements - obtaining the distance of an object by measuring the TOF (*time-of-flight*) of the reflected signal
21+
* data processing on MCU with cross-correlation algorithm - advanced signal processing
22+
* wifi communication - Arduino GIGA R1 platform supports WiFi communication which can be used for faster data transfer between two or more systems
23+
* chirp signal generation - there are many different applications that utilize the chirp signal and the first part of those applications is having the actual chirp
24+
* wheather station - with the pressure sensor provided on the SensEdu shield
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
1335
{: .fw-500}

docs/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ SensEdu was made possible thanks to these freely available tools:
5858
* [Arduino] and [Arduino IDE 2.x]
5959
* [STM32H747 Documentation] and [STM32CubeMX]
6060
* [Jekyll] and [Just the Docs] template
61+
* [KiCAD]
6162

6263
Thank You to All Contributors!
6364
{: .fw-500 .mb-1}
@@ -77,4 +78,5 @@ Thank You to All Contributors!
7778
[Jekyll]: https://jekyllrb.com/
7879
[Just the Docs]: https://github.com/just-the-docs/just-the-docs/tree/main
7980
[STM32H747]: https://www.st.com/en/microcontrollers-microprocessors/stm32h747-757.html
80-
[Arduino GIGA R1 WiFi]: https://docs.arduino.cc/hardware/giga-r1-wifi/
81+
[Arduino GIGA R1 WiFi]: https://docs.arduino.cc/hardware/giga-r1-wifi/
82+
[KiCAD]: https://www.kicad.org/

libraries/SensEdu/src/adc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,22 +214,22 @@ adc_data* get_adc_data(ADC_TypeDef* ADC) {
214214

215215
static ADC_ERROR check_settings(SensEdu_ADC_Settings* settings) {
216216
if (settings->adc != ADC1 && settings->adc != ADC2 && settings->adc != ADC3) {
217-
return ADC_ERROR_WRONG_ADC;
217+
return ADC_ERROR_WRONG_ADC_INSTANCE;
218218
}
219219

220220
if (settings->pin_num < 1) {
221-
return ADC_ERROR_WRONG_INIT_SETTINGS_PARAMETERS;
221+
return ADC_ERROR_INIT_PIN_NUMBER;
222222
}
223223

224224
if (settings->dma_mode == SENSEDU_ADC_DMA_CONNECT) {
225225
if (settings->mem_address == 0x0000 || settings->mem_size == 0) {
226-
return ADC_ERROR_WRONG_INIT_SETTINGS_PARAMETERS;
226+
return ADC_ERROR_INIT_DMA_MEMORY;
227227
}
228228
}
229229

230230
if (settings->conv_mode == SENSEDU_ADC_MODE_CONT_TIM_TRIGGERED) {
231231
if (settings->sampling_freq < 1000) {
232-
return ADC_ERROR_BAD_SAMPLING_FREQ;
232+
return ADC_ERROR_INIT_SAMPLING_FREQ;
233233
}
234234
}
235235

@@ -292,7 +292,7 @@ void configure_pll2(void) {
292292
void adc_init(ADC_TypeDef* ADC, uint8_t* arduino_pins, uint8_t adc_pin_num, SENSEDU_ADC_CONVMODE mode, SENSEDU_ADC_DMA adc_dma) {
293293

294294
if (READ_BIT(ADC->CR, ADC_CR_ADCAL | ADC_CR_JADSTART | ADC_CR_ADSTART | ADC_CR_ADSTP | ADC_CR_ADDIS | ADC_CR_ADEN)) {
295-
error = ADC_ERROR_ADC_CONFIG_VOLTAGE_REGULATOR;
295+
error = ADC_ERROR_ADC_INIT;
296296
}
297297

298298
// exit deep power-down

libraries/SensEdu/src/adc.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ extern "C" {
1515

1616
typedef enum {
1717
ADC_ERROR_NO_ERRORS = 0x00,
18-
ADC_ERROR_WRONG_ADC = 0x01, // use only ADC1 or ADC2
19-
ADC_ERROR_PLL_CONFIG = 0x02,
20-
ADC_ERROR_ADC_CONFIG_VOLTAGE_REGULATOR = 0x03,
21-
ADC_ERROR_ADC_DISABLE_FAIL = 0x04,
22-
ADC_ERROR_ADC_ENABLE_FAIL = 0x05,
23-
ADC_ERROR_PICKED_WRONG_CHANNEL = 0x06,
24-
ADC_ERROR_WRONG_SEQUENCE = 0x07,
25-
ADC_ERROR_SAMPLE_TIME_SETTING = 0x08,
26-
ADC_ERROR_WRONG_OPERATION_MODE = 0x09,
27-
ADC_ERROR_WRONG_DATA_MANAGEMENT_MODE = 0x0A,
28-
ADC_ERROR_WRONG_INIT_SETTINGS_PARAMETERS = 0x0B,
29-
ADC_ERROR_BAD_SAMPLING_FREQ = 0x0C,
30-
ADC_ERROR_NOT_SUPPORTED_MODE = 0x0D
18+
ADC_ERROR_ADC_INIT = 0x01,
19+
ADC_ERROR_WRONG_ADC_INSTANCE = 0x02,
20+
ADC_ERROR_ADC_DISABLE_FAIL = 0x03,
21+
ADC_ERROR_ADC_ENABLE_FAIL = 0x04,
22+
ADC_ERROR_PICKED_WRONG_CHANNEL = 0x05,
23+
ADC_ERROR_INIT_PIN_NUMBER = 0x06,
24+
ADC_ERROR_INIT_DMA_MEMORY = 0x07,
25+
ADC_ERROR_INIT_SAMPLING_FREQ = 0x08,
26+
ADC_ERROR_NOT_SUPPORTED_MODE = 0x09,
27+
28+
ADC_ERROR_PLL_CONFIG = 0xA0,
29+
ADC_ERROR_WRONG_SEQUENCE = 0xA1,
30+
ADC_ERROR_SAMPLE_TIME_SETTING = 0xA2,
31+
ADC_ERROR_WRONG_OPERATION_MODE = 0xA3,
32+
ADC_ERROR_WRONG_DATA_MANAGEMENT_MODE = 0xA4
3133
} ADC_ERROR;
3234

3335
typedef enum {

0 commit comments

Comments
 (0)