8000 rp2/cyw43_configport: Define cyw43 pins. · 32bitmicro/micropython@30163e0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 30163e0

Browse files
peterharperukdpgeorge
authored andcommitted
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>
1 parent 929d7a7 commit 30163e0

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

ports/rp2/cyw43_configport.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,41 @@
5353

5454
#define CYW43_HOST_NAME mod_network_hostname_data
5555

56+
#if CYW43_PIN_WL_DYNAMIC
57+
58+
// Dynamic pins can be changed at runtime before initialising the CYW43
59+
60+
typedef enum cyw43_pin_index_t {
61+
CYW43_PIN_INDEX_WL_REG_ON,
62+
CYW43_PIN_INDEX_WL_DATA_OUT,
63+
CYW43_PIN_INDEX_WL_DATA_IN,
64+
CYW43_PIN_INDEX_WL_HOST_WAKE,
65+
CYW43_PIN_INDEX_WL_CLOCK,
66+
CYW43_PIN_INDEX_WL_CS,
67+
CYW43_PIN_INDEX_WL_COUNT // last
68+
} cyw43_pin_index_t;
69+
70+
// Function to retrieve a cyw43 dynamic pin
71+
uint cyw43_get_pin_wl(cyw43_pin_index_t pin_id);
72+
73+
#define CYW43_PIN_WL_REG_ON cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_REG_ON)
74+
#define CYW43_PIN_WL_DATA_OUT cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_DATA_OUT)
75+
#define CYW43_PIN_WL_DATA_IN cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_DATA_IN)
76+
#define CYW43_PIN_WL_HOST_WAKE cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_HOST_WAKE)
77+
#define CYW43_PIN_WL_CLOCK cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_CLOCK)
78+
#define CYW43_PIN_WL_CS cyw43_get_pin_wl(CYW43_PIN_INDEX_WL_CS)
79+
80+
#else
81+
82+
#define CYW43_PIN_WL_REG_ON CYW43_DEFAULT_PIN_WL_REG_ON
83+
#define CYW43_PIN_WL_DATA_OUT CYW43_DEFAULT_PIN_WL_DATA_OUT
84+
#define CYW43_PIN_WL_DATA_IN CYW43_DEFAULT_PIN_WL_DATA_IN
85+
#define CYW43_PIN_WL_HOST_WAKE CYW43_DEFAULT_PIN_WL_HOST_WAKE
86+
#define CYW43_PIN_WL_CLOCK CYW43_DEFAULT_PIN_WL_CLOCK
87+
#define CYW43_PIN_WL_CS CYW43_DEFAULT_PIN_WL_CS
88+
89+
#endif
90+
5691
#define CYW43_SDPCM_SEND_COMMON_WAIT \
5792
if (get_core_num() == 0) { \
5893
cyw43_yield(); \

0 commit comments

Comments
 (0)
0