You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Remembering variables across resets](https://github.com/stm32duino/Arduino_Core_STM32/wiki/API#Remembering-variables-across-resets)
3
+
*[Core](#core)
4
+
*[Core version](#core-version)
5
+
*[Core Callback](#core-callback)
6
+
*[Wiring](#wiring)
7
+
*[Analog](#analog)
8
+
*[HardwareSerial](#hardwareserial)
9
+
*[[HardwareTimerlibrary]]
10
+
*[Built-In Library](#built-in-library)
11
+
*[SPI](#spi)
12
+
*[I2C](#i2C)
13
+
*[CMSIS DSP](#cmsis-dsp)
14
+
*[EEPROM emulation](#EEPROM-Emulation)
15
+
*[[Servolibrary]]
16
+
*[Other](#other)
17
+
*[Remembering variables across resets](#Remembering-variables-across-resets)
18
18
19
19
# Core
20
20
@@ -60,7 +60,7 @@ _Params_ `func` pointer to the callback function
60
60
61
61
[[/img/Warning-icon.png|alt="Warning"]] By default, the core callback feature is disabled, to enable it `CORE_CALLBACK` must be defined.
62
62
63
-
`build_opt.h` can be used to define it by adding `-DCORE_CALLBACK`, see [build_opt.h wiki](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Customize-build-options-using-build_opt.h).
63
+
[`build_opt.h`][build_opt.h] can be used to define it by adding `-DCORE_CALLBACK`.
64
64
65
65
# Wiring
66
66
@@ -103,7 +103,7 @@ A minimum ADC sampling time is required when reading internal channels so defaul
103
103
* `ADC_SAMPLINGTIME_INTERNAL`
104
104
to the desired ADC sample time.
105
105
106
-
`ADC_SAMPLINGTIME` and `ADC_CLOCK_DIV` could also be redefined by the variant or using `build_opt.h`.
106
+
`ADC_SAMPLINGTIME` and `ADC_CLOCK_DIV` could also be redefined by the variant or using [`build_opt.h`][build_opt.h].
107
107
108
108
#### Example
109
109
An example which read then convert to proper Unit the 3 internal channels + A0 is provided with [STM32Examples](https://github.com/stm32duino/STM32Examples) library:
@@ -137,12 +137,12 @@ void loop() {
137
137
delay(1000);
138
138
}
139
139
```
140
-
Another solution is to add a [build_opt.h](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Customize-build-options-using-build_opt.h) file alongside your main `.ino` file with: `-DENABLE_HWSERIALx`.
140
+
Another solution is to add a [`build_opt.h`][build_opt.h] file alongside your main `.ino` file with: `-DENABLE_HWSERIALx`.
141
141
This will define the `Serialx` instance using the first `USARTx` instance found in the `PeripheralPins.c` of your variant.
142
142
143
143
[[/img/Note-icon.png|alt="Note"]]**Note** that only the latter solution allows to use the `serialEventx()` callback in the sketch.
144
144
145
-
For Example, if you define in the [build_opt.h](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Customize-build-options-using-build_opt.h): `-DENABLE_HWSERIAL3`
145
+
For Example, if you define in the [`build_opt.h`][build_opt.h]: `-DENABLE_HWSERIAL3`
146
146
147
147
This will instantiate `Serial3` with the first Rx and Tx pins found in the `PinMap_UART_RX[]` and `PinMap_UART_TX[]` arrays in the `PeripheralPins.c` of your variant and the `serialEvent3()` will be enabled.
148
148
@@ -154,7 +154,7 @@ Example for the `Serial3`:
154
154
#definePIN_SERIAL3_RX PB11
155
155
#define PIN_SERIAL3_TX PB10
156
156
```
157
-
- In the `build_opt.h`:
157
+
- In the [`build_opt.h`][build_opt.h]:
158
158
`-DPIN_SERIAL3_RX=PB11 -DPIN_SERIAL3_TX=PB10`
159
159
160
160
### New API functions
@@ -289,7 +289,7 @@ void loop() {
289
289
}
290
290
```
291
291
292
-
**Note:** Serial Rx/TX buffer size can be changed, see [custom definitions](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Custom-definitions#serial-rxtx-buffer-size)
292
+
**Note:** Serial Rx/TX buffer size can be changed, see [[custom definitions|Custom-definitions#serial-rxtx-buffer-size]]
Refers to [I2C Timing](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Custom-definitions#i2c-timing) to customize I2C speed if needed.
447
+
Refers to [[I2C Timing|Custom-definitions#i2c-timing]] to customize I2C speed if needed.
448
448
449
449
### Default I2C pins
450
450
**The default I2C interface pins are configured inside the PeripheralPins.c file.**
@@ -539,9 +539,9 @@ By default I2C buffers are all aligned on Arduino API: **32 bytes**.
539
539
Nevertheless it is possible to transfer up to **255 bytes**:
540
540
* In master mode: RX and TX buffers will automatically grow when needed, independently one from each other, and independently from other I2C instances.
541
541
Nothing to do from application point of view.
542
-
Warning: a bug in STM32 cube HAL (STM32 core v1.8.0) prevents to transfer exactly 255 bytes.(see [#853](https://github.com/stm32duino/Arduino_Core_STM32/pull/853))
542
+
Warning: a bug in STM32 cube HAL (STM32 core v1.8.0) prevents to transfer exactly 255 bytes.(see [#853])
543
543
544
-
* In slave mode: RX and TX buffer size can be statically redefined using [hal_conf_extra.h](https://github.com/stm32duino/Arduino_Core_STM32/wiki/HAL-configuration#core-version--150-1) or [build_opt.h](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Customize-build-options-using-build_opt.h) (at compilation time) thanks to switch `I2C_TXRX_BUFFER_SIZE` (see [#853](https://github.com/stm32duino/Arduino_Core_STM32/pull/853))
544
+
* In slave mode: RX and TX buffer size can be statically redefined using [[hal_conf_extra.h|HAL-configuration#core-version--150-1]] or [`build_opt.h`][build_opt.h] (at compilation time) thanks to switch `I2C_TXRX_BUFFER_SIZE` (see [#853])
545
545
All I2C instances are impacted by change of this compilation switch.
Since core version 1.9.0 (see [PR #996](https://github.com/stm32duino/Arduino_Core_STM32/pull/996)), it is possible to mark variables as "noinit", which prevents them from being initialized to a fixed value at startup. This allows using these variables to remember a value across resets (since the reset itself leaves memory unchanged, it is only the startup code that normally resets all variable values, but that is prevented by noinit).
616
+
Since core version 1.9.0 (see [#996](../pull/996)), it is possible to mark variables as "noinit", which prevents them from being initialized to a fixed value at startup. This allows using these variables to remember a value across resets (since the reset itself leaves memory unchanged, it is only the startup code that normally resets all variable values, but that is prevented by noinit).
618
617
619
618
To do this, the variable must be placed in the `.noinit` section by adding `__attribute__((__section__(".noinit")))` (this is exactly the same as how this works on the original Arduino AVR core). Typically, you would also need to check the startup reason register so you can initialize the variable with a default on the first startup. For example, something like:
620
619
@@ -638,4 +637,7 @@ void setup() {
638
637
void loop() { }
639
638
```
640
639
641
-
This shows the number of boots since the last POR by incrementing a noinit variable across resets. Note that when you first upload this, it might not start at 1 but at some arbitrary value, because typically the first boot after an upload is not a power-on-reset. To start at 1, disconnect and reconnect power.
640
+
This shows the number of boots since the last POR by incrementing a noinit variable across resets. Note that when you first upload this, it might not start at 1 but at some arbitrary value, because typically the first boot after an upload is not a power-on-reset. To start at 1, disconnect and reconnect power.
Copy file name to clipboardExpand all lines: Astyle.md
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
# Astyle
2
2
3
-
[AStyle](http://astyle.sourceforge.net/) is used for coding style checking.
3
+
[AStyle] is used for coding style checking.
4
4
5
5
> Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C++/CLI, Objective‑C, C# and Java programming languages.
6
6
7
-
GitHub action is used to ensure each PR (Pull Request) and `main` branch of the [STM32 core](https://github.com/stm32duino/Arduino_Core_STM32) follow the code style definition defined.
7
+
GitHub action is used to ensure each PR (Pull Request) and `main` branch of the [STM32 core] follow the code style definition defined.
8
8
9
-
Only sources files (`*.h`, `*.hpp`, `*.c`, `*.cpp`) from the following [STM32 core](https://github.com/stm32duino/Arduino_Core_STM32) directory lists are checked:
9
+
Only sources files (`*.h`, `*.hpp`, `*.c`, `*.cpp`) from the following [STM32 core] directory lists are checked:
10
10
*`cores/`
11
11
*`libraries/`
12
12
*`variants/`
13
13
14
14
## Ignored files
15
-
[.astyleignore](https://github.com/stm32duino/Arduino_Core_STM32/blob/main/CI/astyle/.astyleignore) file contains list of folder to ignore.
15
+
[`.astyleignore`](https://github.com/stm32duino/Arduino_Core_STM32/blob/main/CI/astyle/.astyleignore) file contains list of folder to ignore.
16
16
17
17
## Code style definition
18
18
19
-
Hereafter the code style definition applied ([.astylerc](https://github.com/stm32duino/Arduino_Core_STM32/blob/main/CI/astyle/.astylerc))
19
+
Hereafter the code style definition applied ([`.astylerc`](https://github.com/stm32duino/Arduino_Core_STM32/blob/main/CI/astyle/.astylerc))
20
20
21
21
```bash
22
22
# STM32duino code style definition file for Astyle
@@ -66,7 +66,7 @@ keep-one-line-statements
66
66
67
67
## Python script
68
68
69
-
Python script [astyle.py](https://github.com/stm32duino/Arduino_Core_STM32/blob/main/CI/astyle/astyle.py) is provided to ease use of [AStyle](http://astyle.sourceforge.net/):
69
+
Python script [`astyle.py`](https://github.com/stm32duino/Arduino_Core_STM32/blob/main/CI/astyle/astyle.py) is provided to ease use of [AStyle]:
Copy file name to clipboardExpand all lines: Getting-Started.md
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ Then you can find the Nucleo-64 boards available in a sub-menu of the "Tools" me
60
60
61
61
## Extra step
62
62
63
-
To upload through SWD (STLink), Serial or DFU, [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) needs to be installed. See [Upload methods](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Upload-methods#stm32cubeprogrammer).
63
+
To upload through SWD (STLink), Serial or DFU, [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) needs to be installed. See [[Upload methods|Upload-methods#stm32cubeprogrammer]].
64
64
65
65
## Troubleshooting
66
66
@@ -72,19 +72,19 @@ If you have any issue to download a package, ensure to not be behind a proxy.
72
72
Else configure the proxy in the Arduino.cc IDE (open the "**Preferences**" dialog and select "**Network**" tab).
73
73
74
74
# Configuring IDE
75
-
1. Connect a board to the computer USB port. For this example: [Nucleo L476RG](http://www.st.com/en/evaluation-tools/nucleo-l476rg.html)
75
+
1. Connect a board to the computer USB port. For this example: [Nucleo L476RG]
76
76
77
77
2. Launch the Arduino software
78
78
79
79
[[/img/arduino.png|alt="Arduino icon"]]
80
80
81
-
3. Select the [Nucleo L476RG](http://www.st.com/en/evaluation-tools/nucleo-l476rg.html) board in two steps:
81
+
3. Select the [Nucleo L476RG] board in two steps:
82
82
83
83
a. From the "**Tools > Board**" menu, select the STM32 boards groups: _Nucleo-64_
84
84
85
85
[[/img/boardslist.png|alt="Board selection"]]
86
86
87
-
b. Then from the "**Tools > Board part number**" menu, select the [Nucleo L476RG](http://www.st.com/en/evaluation-tools/nucleo-l476rg.html)
87
+
b. Then from the "**Tools > Board part number**" menu, select the [Nucleo L476RG]
88
88
89
89
[[/img/SelectBoard.png|alt="Board selection"]]
90
90
@@ -101,10 +101,13 @@ b. Then from the "**Tools > Board part number**" menu, select the [Nucleo L476RG
101
101
## Upload methods
102
102
Depending of the board, several upload methods could be proposed, thanks the "**Tools > Upload Method**" menu.
103
103
104
-
See [Upload methods](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Upload-methods) for more details.
104
+
See [[Upload methods]] for more details.
105
105
106
106
[[/img/UploadMethod.png|alt="Upload Method"]]
107
107
108
108
# Examples
109
109
*[[Blink-example]]
110
110
*[[Firmata-example]] (to use with [ScratchX](http://scratchx.org/) for example)
0 commit comments