aboutsummaryrefslogtreecommitdiff
path: root/docs/drivers/spi.md
diff options
context:
space:
mode:
authorQMK Bot <[email protected]>2024-11-14 18:00:36 +0000
committerQMK Bot <[email protected]>2024-11-14 18:00:36 +0000
commit79a661fe61f28e2df76b94f36f0cc3366f088f70 (patch)
tree640dfe2af0b851fa4c303e48be8ee9771ae4847a /docs/drivers/spi.md
parent0bda0f47754d01aa904f9831ff58ef760807ab16 (diff)
parent46236ce3de8385f27e3f13a9921abee7e1e0fa57 (diff)
downloadqmk_firmware-79a661fe61f28e2df76b94f36f0cc3366f088f70.tar.gz
qmk_firmware-79a661fe61f28e2df76b94f36f0cc3366f088f70.zip
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'docs/drivers/spi.md')
-rw-r--r--docs/drivers/spi.md25
1 files changed, 16 insertions, 9 deletions
diff --git a/docs/drivers/spi.md b/docs/drivers/spi.md
index ddc35de851..43d2a056d5 100644
--- a/docs/drivers/spi.md
+++ b/docs/drivers/spi.md
@@ -32,20 +32,27 @@ You may use more than one slave select pin, not just the `SS` pin. This is usefu
You'll need to determine which pins can be used for SPI -- as an example, STM32 parts generally have multiple SPI peripherals, labeled SPI1, SPI2, SPI3 etc.
-To enable SPI, modify your board's `halconf.h` to enable SPI:
+To enable SPI, modify your board's `halconf.h` to enable SPI, then modify your board's `mcuconf.h` to enable the peripheral you've chosen:
-```c
-#define HAL_USE_SPI TRUE
-#define SPI_USE_WAIT TRUE
-#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
+::: code-group
+```c [halconf.h]
+#pragma once
+
+#define HAL_USE_SPI TRUE // [!code focus]
+#define SPI_USE_WAIT TRUE // [!code focus]
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD // [!code focus]
+
+#include_next <halconf.h>
```
+```c [mcuconf.h]
+#pragma once
-Then, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
+#include_next <mcuconf.h>
-```c
-#undef STM32_SPI_USE_SPI2
-#define STM32_SPI_USE_SPI2 TRUE
+#undef STM32_SPI_USE_SPI2 // [!code focus]
+#define STM32_SPI_USE_SPI2 TRUE // [!code focus]
```
+:::
Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.