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
{{ message }}
Repository navigation
Commit 05fb284
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/API.md
-262Lines changed: 0 additions & 262 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -369,268 +369,6 @@ parity bit is also inverted.
369
369
See the [HardwareTimer library reference](HardwareTimer-library.md) for the timer API and STM32-specific timer features.
370
370
371
371
372
-
## Built-in libraries
373
-
374
-
This part describes the STM32 libraries provided with the core.
375
-
376
-
### SPI
377
-
378
-
STM32 SPI library has been modified with the possibility to manage hardware CS pin linked to the SPI peripheral.
379
-
This section documents STM32-specific additions to the [standard SPI API](https://docs.arduino.cc/language-reference/en/functions/communication/SPI/).
380
-
381
-
There are two ways to manage the CS pin:
382
-
383
-
- the CS pin is managed directly by the user code before to transfer the data (like the Arduino SPI library)
384
-
- the user uses a hardware CS pin linked to the SPI peripheral
385
-
386
-
#### New SPISetting parameter
387
-
388
-
*`noReceive`: value can be `SPI_TRANSMITRECEIVE` or `SPI_TRANSMITONLY`. It allows to skip receive data after transmitting.
389
-
390
-
#### New API functions
391
-
392
-
*`SPIClass::SPIClass(uint8_t mosi, uint8_t miso, uint8_t sclk, uint8_t ssel)`: alternative class constructor
393
-
_Params_ SPI `mosi` pin
394
-
_Params_ SPI `miso` pin
395
-
_Params_ SPI `sclk` pin
396
-
_Params_ (optional) SPI `ssel` pin. This pin must be an hardware CS pin. If you configure this pin, the chip select will be managed by the SPI peripheral.
397
-
398
-
###### Example
399
-
400
-
This is an example of the use of the hardware CS pin linked to the SPI peripheral:
It is also possible to change the default pins used by the `Wire` instance using above API:
525
-
526
-
*`void setSCL(uint32_t scl)`
527
-
*`void setSDA(uint32_t sda)`
528
-
*`void setSCL(PinName scl)`
529
-
*`void setSDA(PinName sda)`
530
-
531
-
> [!WARNING]
532
-
> Have to be called before `begin()`.
533
-
534
-
###### Example:
535
-
```C++
536
-
Wire.setSDA(PC_4); // using pin name PY_n
537
-
Wire.setSCL(PC2); // using pin number PYn
538
-
Wire.begin();
539
-
```
540
-
541
-
##### Enable general call mode
542
-
Available in core version greater than **1.5.0**
543
-
544
-
Adding `true` as last parameters of the 3 `Wire::begin()` methods will enable the general call mode otherwise `false` per default:
545
-
546
-
*`void begin(bool generalCall = false)`
547
-
*`void begin(uint8_t, bool generalCall = false)`
548
-
*`void begin(int, bool generalCall = false)`
549
-
550
-
###### Example
551
-
`Wire.begin(true);` or `Wire.begin(0x70,true);`
552
-
553
-
#### I2C buffer management
554
-
By default, I2C buffers are aligned with the Arduino API at **32 bytes**. Transfers of up to **255 bytes** are also possible:
555
-
556
-
- In master mode: RX and TX buffers will automatically grow when needed, independently one from each other, and independently from other I2C instances. Nothing to do from application point of view. Warning: a bug in STM32 cube HAL (STM32 core v1.8.0) prevents to transfer exactly 255 bytes. (see [PR #853])
557
-
558
-
- In slave mode: RX and TX buffer size can be statically redefined using [hal_conf_extra.h](customization/HAL-configuration.md) or [`build_opt.h`][build_opt.h] (at compilation time) thanks to switch `I2C_TXRX_BUFFER_SIZE` (see [PR #853]). All I2C instances are impacted by change of this compilation switch.
559
-
560
-
### CMSIS-DSP
561
-
562
-
Available in core version greater than **1.7.0**
563
-
564
-
CMSIS-DSP is a suite of common signal-processing functions for Cortex-M devices.
565
-
566
-
The library is divided into a number of functions each covering a specific category:
567
-
568
-
- Basic math functions
569
-
- Fast math functions
570
-
- Complex math functions
571
-
- Filters
572
-
- Matrix functions
573
-
- Transform functions
574
-
- Motor control functions
575
-
- Statistical functions
576
-
- Support functions
577
-
- Interpolation functions.
578
-
579
-
The library has separate functions for operating on 8-bit integers, 16-bit integers, 32-bit integer and 32-bit floating-point value.
Emulation is made in Flash, with all constraints related to Flash operation:
598
-
599
-
- whole sector/page erased and written for each write operation. This can be very long depending on sector/page size.
600
-
- limited Flash life cycle write operation
601
-
602
-
In addition to Arduino API, to mitigate Flash constraints, it is possible to use buffered API:
603
-
Write operations are made in an intermediate RAM buffer, and only at the end (after writing several parameters for example) the buffer is copied in Flash. Thus only 1 write operation for a whole bunch of data.
604
-
Example is available here: https://github.com/stm32duino/STM32Examples/tree/main/examples/NonReg/BufferedEEPROM
605
-
```C
606
-
voideeprom_buffer_fill(); // This function copies the data from flash into the buffer
607
-
voideeprom_buffer_flush(); // This function writes the buffer content into the flash
608
-
uint8_teeprom_buffered_read_byte(const uint32_t pos); // Function reads a byte from the eeprom buffer
609
-
void eeprom_buffered_write_byte(uint32_t pos, uint8_t value); // Function writes a byte to the eeprom buffer
610
-
```
611
-
By default, EEPROM emulation storage correspond to the last sector/page of Flash,
612
-
and its size correspond to the size of the last sector/page.
613
-
Nevertheless it is possible to customize address and size used for EEPROM.
614
-
In this case, following switches should be defined (in variant.h or [`build_opt.h`][build_opt.h])
615
-
616
-
- `FLASH_BASE_ADDRESS`
617
-
- `FLASH_DATA_SECTOR` or `FLASH_PAGE_NUMBER` (depending on STM32 family used)
618
-
619
-
see example of variant implementation: [PR #938](https://github.com/stm32duino/Arduino_Core_STM32/pull/938)
620
-
621
-
> [!WARNING]
622
-
> Single/dual bank configuration:
623
-
>
624
-
> Default last sector used correspond to default board configuration.
625
-
>
626
-
> For example, NUCLEO_F767ZI is by default configured in single bank. Last sector correspond to this bank configuration.
627
-
> If this configuration is changed, it is then mandatory to customize `FLASH_BASE_ADDRESS`/`FLASH_DATA_SECTOR`,
628
-
> even to use last sector of Flash.
629
-
630
-
### Servo library
631
-
632
-
See the [Servo library reference](libraries/built-in/Servo-library.md) for the supported Servo API.
Emulation is made in Flash, with all constraints related to Flash operation:
7
+
8
+
- whole sector/page erased and written for each write operation. This can be very long depending on sector/page size.
9
+
- limited Flash life cycle write operation
10
+
11
+
In addition to Arduino API, to mitigate Flash constraints, it is possible to use buffered API:
12
+
Write operations are made in an intermediate RAM buffer, and only at the end (after writing several parameters for example) the buffer is copied in Flash. Thus only 1 write operation for a whole bunch of data.
13
+
Example is available here: https://github.com/stm32duino/STM32Examples/tree/main/examples/NonReg/BufferedEEPROM
14
+
```C
15
+
voideeprom_buffer_fill(); // This function copies the data from flash into the buffer
16
+
voideeprom_buffer_flush(); // This function writes the buffer content into the flash
17
+
uint8_teeprom_buffered_read_byte(const uint32_t pos); // Function reads a byte from the eeprom buffer
18
+
void eeprom_buffered_write_byte(uint32_t pos, uint8_t value); // Function writes a byte to the eeprom buffer
19
+
```
20
+
By default, EEPROM emulation storage correspond to the last sector/page of Flash,
21
+
and its size correspond to the size of the last sector/page.
22
+
Nevertheless it is possible to customize address and size used for EEPROM.
23
+
In this case, following switches should be defined (in variant.h or [`build_opt.h`][build_opt.h])
24
+
25
+
- `FLASH_BASE_ADDRESS`
26
+
- `FLASH_DATA_SECTOR` or `FLASH_PAGE_NUMBER` (depending on STM32 family used)
27
+
28
+
see example of variant implementation: [PR #938](https://github.com/stm32duino/Arduino_Core_STM32/pull/938)
29
+
30
+
> [!WARNING]
31
+
> Single/dual bank configuration:
32
+
>
33
+
> Default last sector used correspond to default board configuration.
34
+
>
35
+
> For example, NUCLEO_F767ZI is by default configured in single bank. Last sector correspond to this bank configuration.
36
+
> If this configuration is changed, it is then mandatory to customize `FLASH_BASE_ADDRESS`/`FLASH_DATA_SECTOR`,
0 commit comments