aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2020-04-13 17:09:50 +1000
committerGitHub <noreply@github.com>2020-04-13 17:09:50 +1000
commit46e449376163779413b74f81e320a7d7bbd7e13b (patch)
tree8bd54b95a66d0f2db3a01ce137b3e6bba5ba6f8d /docs
parent157d121c71104abb564643f7b6152d149c01fc20 (diff)
downloadqmk_firmware-46e449376163779413b74f81e320a7d7bbd7e13b.tar.gz
qmk_firmware-46e449376163779413b74f81e320a7d7bbd7e13b.zip
Fix AVR SPI parameter configuration, remove timeouts due to sync protocol. (#8775)
Diffstat (limited to 'docs')
-rw-r--r--docs/spi_driver.md31
1 files changed, 12 insertions, 19 deletions
diff --git a/docs/spi_driver.md b/docs/spi_driver.md
index 360796d2a..e2b5b140b 100644
--- a/docs/spi_driver.md
+++ b/docs/spi_driver.md
@@ -16,7 +16,7 @@ No special setup is required - just connect the `SS`, `SCK`, `MOSI` and `MISO` p
16You may use more than one slave select pin, not just the `SS` pin. This is useful when you have multiple devices connected and need to communicate with them individually. 16You may use more than one slave select pin, not just the `SS` pin. This is useful when you have multiple devices connected and need to communicate with them individually.
17`SPI_SS_PIN` can be passed to `spi_start()` to refer to `SS`. 17`SPI_SS_PIN` can be passed to `spi_start()` to refer to `SS`.
18 18
19## ARM Configuration 19## ChibiOS/ARM Configuration
20 20
21ARM support for this driver is not ready yet. Check back later! 21ARM support for this driver is not ready yet. Check back later!
22 22
@@ -28,7 +28,7 @@ Initialize the SPI driver. This function must be called only once, before any of
28 28
29--- 29---
30 30
31### `void spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint8_t divisor)` 31### `bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor)`
32 32
33Start an SPI transaction. 33Start an SPI transaction.
34 34
@@ -48,12 +48,16 @@ Start an SPI transaction.
48 |`2` |Leading edge falling|Sample on leading edge | 48 |`2` |Leading edge falling|Sample on leading edge |
49 |`3` |Leading edge falling|Sample on trailing edge| 49 |`3` |Leading edge falling|Sample on trailing edge|
50 50
51 - `uint8_t divisor` 51 - `uint16_t divisor`
52 The SPI clock divisor, will be rounded up to the nearest power of two. This number can be calculated by dividing the MCU's clock speed by the desired SPI clock speed. For example, an MCU running at 8 MHz wanting to talk to an SPI device at 4 MHz would set the divisor to `2`. 52 The SPI clock divisor, will be rounded up to the nearest power of two. This number can be calculated by dividing the MCU's clock speed by the desired SPI clock speed. For example, an MCU running at 8 MHz wanting to talk to an SPI device at 4 MHz would set the divisor to `2`.
53 53
54#### Return Value
55
56`false` if the supplied parameters are invalid or the SPI peripheral is already in use, or `true`.
57
54--- 58---
55 59
56### `spi_status_t spi_write(uint8_t data, uint16_t timeout)` 60### `spi_status_t spi_write(uint8_t data)`
57 61
58Write a byte to the selected SPI device. 62Write a byte to the selected SPI device.
59 63
@@ -61,8 +65,6 @@ Write a byte to the selected SPI device.
61 65
62 - `uint8_t data` 66 - `uint8_t data`
63 The byte to write. 67 The byte to write.
64 - `uint16_t timeout`
65 The amount of time to wait, in milliseconds, before timing out.
66 68
67#### Return Value 69#### Return Value
68 70
@@ -70,22 +72,17 @@ Write a byte to the selected SPI device.
70 72
71--- 73---
72 74
73### `spi_status_t spi_read(uint16_t timeout)` 75### `spi_status_t spi_read(void)`
74 76
75Read a byte from the selected SPI device. 77Read a byte from the selected SPI device.
76 78
77#### Arguments
78
79 - `uint16_t timeout`
80 The amount of time to wait, in milliseconds, before timing out.
81
82#### Return Value 79#### Return Value
83 80
84`SPI_STATUS_TIMEOUT` if the timeout period elapses, or the byte read from the device. 81`SPI_STATUS_TIMEOUT` if the timeout period elapses, or the byte read from the device.
85 82
86--- 83---
87 84
88### `spi_status_t spi_transmit(const uint8_t *data, uint16_t length, uint16_t timeout)` 85### `spi_status_t spi_transmit(const uint8_t *data, uint16_t length)`
89 86
90Send multiple bytes to the selected SPI device. 87Send multiple bytes to the selected SPI device.
91 88
@@ -95,8 +92,6 @@ Send multiple bytes to the selected SPI device.
95 A pointer to the data to write from. 92 A pointer to the data to write from.
96 - `uint16_t length` 93 - `uint16_t length`
97 The number of bytes to write. Take care not to overrun the length of `data`. 94 The number of bytes to write. Take care not to overrun the length of `data`.
98 - `uint16_t timeout`
99 The amount of time to wait, in milliseconds, before timing out.
100 95
101#### Return Value 96#### Return Value
102 97
@@ -104,7 +99,7 @@ Send multiple bytes to the selected SPI device.
104 99
105--- 100---
106 101
107### `spi_status_t spi_receive(uint8_t *data, uint16_t length, uint16_t timeout)` 102### `spi_status_t spi_receive(uint8_t *data, uint16_t length)`
108 103
109Receive multiple bytes from the selected SPI device. 104Receive multiple bytes from the selected SPI device.
110 105
@@ -114,12 +109,10 @@ Receive multiple bytes from the selected SPI device.
114 A pointer to the buffer to read into. 109 A pointer to the buffer to read into.
115 - `uint16_t length` 110 - `uint16_t length`
116 The number of bytes to read. Take care not to overrun the length of `data`. 111 The number of bytes to read. Take care not to overrun the length of `data`.
117 - `uint16_t timeout`
118 The amount of time to wait, in milliseconds, before timing out.
119 112
120#### Return Value 113#### Return Value
121 114
122`SPI_STATUS_TIMEOUT` if the timeout period elapses, `SPI_STATUS_SUCCESS` on success, or `SPI_STATUS_ERROR` otherwise. 115`SPI_STATUS_TIMEOUT` if the internal transmission timeout period elapses, `SPI_STATUS_SUCCESS` on success, or `SPI_STATUS_ERROR` otherwise.
123 116
124--- 117---
125 118