summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Harper <peter.harper@raspberrypi.com>2024-10-23 16:41:54 +0100
committerDamien George <damien@micropython.org>2024-12-19 16:54:39 +1100
commit30163e0ae483a3c04e57f8346e903a6bc2e0e2cd (patch)
tree2c13d065013518c9d50ce6c92705a6e7706be3e5
parent929d7a75265e7f5ed898560b065fd33af5a18264 (diff)
rp2/cyw43_configport: Define cyw43 pins.
The cyw43 pins used to be hardcoded and `CYW43_PIN_WL_HOST_WAKE` and `CYW43_PIN_WL_REG_ON` were in the `pico_w.h` board header. This has been changed so the board header just defines the "default version of the pins, e.g. `CYW43_DEFAULT_PIN_WL_HOST_WAKE`, `CYW43_DEFAULT_PIN_WL_REG_ON` etc. Set the pin values in `cyw43_configport.`h so `cyw43-driver` sees them and allow them to be changed at runtime (dynamic) if required. Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
-rw-r--r--ports/rp2/cyw43_configport.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/ports/rp2/cyw43_configport.h b/ports/rp2/cyw43_configport.h
index 4b012ce17..4294691c6 100644
--- a/ports/rp2/cyw43_configport.h
+++ b/ports/rp2/cyw43_configport.h
@@ -53,6 +53,41 @@
#define CYW43_HOST_NAME mod_network_hostname_data
+#if CYW43_PIN_WL_DYNAMIC
+
+// Dynamic pins can be changed at runtime before initialising the CYW43
+
+typedef enum cyw43_pin_index_t {
+ CYW43_PIN_INDEX_WL_REG_ON,
+ CYW43_PIN_INDEX_WL_DATA_OUT,
+ CYW43_PIN_INDEX_WL_DATA_IN,
+ CYW43_PIN_INDEX_WL_HOST_WAKE,
+ CYW43_PIN_INDEX_WL_CLOCK,
+ CYW43_PIN_INDEX_WL_CS,
+ CYW43_PIN_INDEX_WL_COUNT // last
+} cyw43_pin_index_t;
+
+// Function to retrieve a cyw43 dynamic pin
+uint cyw43_get_pin_wl(cyw43_pin_index_t pin_id);
+
+#define CYW43_PIN_WL_REG_ON cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_REG_ON)
+#define CYW43_PIN_WL_DATA_OUT cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_DATA_OUT)
+#define CYW43_PIN_WL_DATA_IN cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_DATA_IN)
+#define CYW43_PIN_WL_HOST_WAKE cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_HOST_WAKE)
+#define CYW43_PIN_WL_CLOCK cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_CLOCK)
+#define CYW43_PIN_WL_CS cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_CS)
+
+#else
+
+#define CYW43_PIN_WL_REG_ON CYW43_DEFAULT_PIN_WL_REG_ON
+#define CYW43_PIN_WL_DATA_OUT CYW43_DEFAULT_PIN_WL_DATA_OUT
+#define CYW43_PIN_WL_DATA_IN CYW43_DEFAULT_PIN_WL_DATA_IN
+#define CYW43_PIN_WL_HOST_WAKE CYW43_DEFAULT_PIN_WL_HOST_WAKE
+#define CYW43_PIN_WL_CLOCK CYW43_DEFAULT_PIN_WL_CLOCK
+#define CYW43_PIN_WL_CS CYW43_DEFAULT_PIN_WL_CS
+
+#endif
+
#define CYW43_SDPCM_SEND_COMMON_WAIT \
if (get_core_num() == 0) { \
cyw43_yield(); \