Skip to content

Commit 2cfa518

Browse files
authored
update stm32 example for rt-thread 5.0.0
1 parent ad53827 commit 2cfa518

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

example/rw007_stm32_port.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,18 @@ int wifi_spi_device_init(void)
128128
{
129129
char sn_version[32];
130130

131+
rw007_gpio_init();
132+
133+
#if (RT_VER_NUM >= 0x50000)
134+
rt_hw_spi_device_attach(RW007_SPI_BUS_NAME, "wspi", RW007_CS_PIN);
135+
#else
131136
GPIO_TypeDef *cs_gpiox;
132137
uint16_t cs_pin;
133-
134138
cs_gpiox = (GPIO_TypeDef *)((rt_base_t)GPIOA + (rt_base_t)(RW007_CS_PIN / 16) * 0x0400UL);
135139
cs_pin = (uint16_t)(1 << RW007_CS_PIN % 16);
136-
137-
rw007_gpio_init();
138140
rt_hw_spi_device_attach(RW007_SPI_BUS_NAME, "wspi", cs_gpiox, cs_pin);
141+
#endif
142+
139143
rt_hw_wifi_init("wspi");
140144

141145
rt_wlan_set_mode(RT_WLAN_DEVICE_STA_NAME, RT_WLAN_STATION);

0 commit comments

Comments
 (0)