Просмотр исходного кода

增加升级功能 修复warning

zyh 6 лет назад
Родитель
Сommit
e566a2fc3a
3 измененных файлов с 13 добавлено и 5 удалено
  1. 11 0
      example/rw007_stm32_port.c
  2. 1 3
      inc/spi_wifi_rw007.h
  3. 1 2
      src/spi_wifi_rw007.c

+ 11 - 0
example/rw007_stm32_port.c

@@ -55,6 +55,17 @@ int wifi_spi_device_init(void)
 }
 INIT_APP_EXPORT(wifi_spi_device_init);
 
+static int rw007_update(void)
+{
+    rt_device_t device = rt_device_find(RW007_SPI_BUS_NAME);
+    struct stm32_spi *hspi = (struct stm32_spi *)device->user_data;
+    __HAL_SPI_DISABLE((SPI_HandleTypeDef *)hspi);
+    HAL_SPI_MspDeInit((SPI_HandleTypeDef *)hspi);
+    set_rw007_mode(RW007_AT_MODE);
+    return 0;
+}
+MSH_CMD_EXPORT(rw007_update, rw007_update);
+
 static void int_wifi_irq(void * p)
 {
     ((void)p);

+ 1 - 3
inc/spi_wifi_rw007.h

@@ -14,9 +14,7 @@
 
 #include <stdint.h>
 #include "lwipopts.h"
-#include <lwip/icmp.h>
-#include <netif/etharp.h>
-#include <netif/ethernetif.h>
+#include <rtdevice.h>
 
 // little-endian
 struct spi_cmd_request

+ 1 - 2
src/spi_wifi_rw007.c

@@ -12,8 +12,7 @@
  * 2019-02-25     zyh          porting rw007 to wlan 
  */
 #include <rtthread.h>
-#include <rtdevice.h>
-
+#include <string.h>
 
 #ifndef RW007_LOG_LEVEL
 #define RW007_LOG_LEVEL DBG_LOG