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
Copy file name to clipboardExpand all lines: libraries/SPI/README.md
+23-9
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,18 @@ User have 2 possibilities about the management of the CS pin:
7
7
* the CS pin is managed directly by the user code before to transfer the data (like the Arduino SPI library)
8
8
* the user uses a hardware CS pin linked to the SPI peripheral
9
9
10
-
###New API functions
10
+
## New API functions
11
11
12
-
*`SPIClass::SPIClass(uint8_t mosi, uint8_t miso, uint8_t sclk, uint8_t ssel)`: alternative class constructor
13
-
_Params_ SPI `mosi` pin
14
-
_Params_ SPI `miso` pin
15
-
_Params_ SPI `sclk` pin
16
-
_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.
*`SPI_HandleTypeDef *getHandle(void)`: Could be used to mix Arduino API and STM32Cube HAL API (ex: DMA). **Use at your own risk.**
17
+
_Param_ SPI `miso` pin
19
18
19
+
_Param_ SPI `sclk` pin
20
+
21
+
_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.
20
22
21
23
##### Example
22
24
@@ -35,9 +37,15 @@ void setup() {
35
37
}
36
38
```
37
39
38
-
### Extended API
40
+
#### Transfer with Tx/Rx buffer
41
+
42
+
* `void transfer(const void *tx_buf, void *rx_buf, size_t count)` :Transfer several bytes. One constant buffer used to send and one to receive data.
39
43
40
-
* All `transfer()` API's have a new bool argument `skipReceive`. It allows to skip receive data after transmitting. Value can be `SPI_TRANSMITRECEIVE` or `SPI_TRANSMITONLY`. Default `SPI_TRANSMITRECEIVE`.
44
+
_Param_ `tx_buf`: constant array of Tx bytes that is filled by the user before starting the SPI transfer. If NULL, default dummy 0xFF bytes will be clocked out.
45
+
46
+
_Param_ `rx_buf`: array of Rx bytes that will be filled by the slave during the SPI transfer. If NULL, the received data will be discarded.
47
+
48
+
_Param_ `count`: number of bytes to send/receive.
41
49
42
50
#### Change default `SPI` instance pins
43
51
It is also possible to change the default pins used by the `SPI` instance using above API:
@@ -63,3 +71,9 @@ It is also possible to change the default pins used by the `SPI` instance using
63
71
SPI.setMOSI(PC2); // using pin number PYn
64
72
SPI.begin(2);
65
73
```
74
+
75
+
*`SPI_HandleTypeDef *getHandle(void)`: Could be used to mix Arduino API and STM32Cube HAL API (ex: DMA). **Use at your own risk.**
76
+
77
+
## Extended API
78
+
79
+
* All defaustatndard `transfer()` API's have a new bool argument `skipReceive`. It allows to skip receive data after transmitting. Value can be `SPI_TRANSMITRECEIVE` or `SPI_TRANSMITONLY`. Default `SPI_TRANSMITRECEIVE`.
0 commit comments