mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
Merge branch 'master' of gitee.com:iot_camp/wumei-smart
This commit is contained in:
@@ -2,38 +2,36 @@
|
||||
LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_i2c.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_i2c.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/tz_context.h;
|
||||
|
||||
[PreviousUsedKeilFiles]
|
||||
SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\adc.c;..\Core\Src\dma.c;..\Core\Src\i2c.c;..\Core\Src\spi.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\Core\Src\stm32f1xx_it.c;..\Core\Src\stm32f1xx_hal_msp.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;..\Core\Src/system_stm32f1xx.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;..\Core\Src/system_stm32f1xx.c;..\Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;;
|
||||
SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\adc.c;..\Core\Src\i2c.c;..\Core\Src\spi.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\Core\Src\stm32f1xx_it.c;..\Core\Src\stm32f1xx_hal_msp.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;..\Core\Src/system_stm32f1xx.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;..\Core\Src/system_stm32f1xx.c;..\Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;;
|
||||
HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;..\Core\Inc;
|
||||
CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER;
|
||||
|
||||
[PreviousGenFiles]
|
||||
AdvancedFolderStructure=true
|
||||
HeaderFileListSize=10
|
||||
HeaderFiles#0=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/gpio.h
|
||||
HeaderFiles#1=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/adc.h
|
||||
HeaderFiles#2=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/dma.h
|
||||
HeaderFiles#3=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/i2c.h
|
||||
HeaderFiles#4=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/spi.h
|
||||
HeaderFiles#5=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/tim.h
|
||||
HeaderFiles#6=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/usart.h
|
||||
HeaderFiles#7=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/stm32f1xx_it.h
|
||||
HeaderFiles#8=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/stm32f1xx_hal_conf.h
|
||||
HeaderFiles#9=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc/main.h
|
||||
HeaderFileListSize=9
|
||||
HeaderFiles#0=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/gpio.h
|
||||
HeaderFiles#1=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/adc.h
|
||||
HeaderFiles#2=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/i2c.h
|
||||
HeaderFiles#3=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/spi.h
|
||||
HeaderFiles#4=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/tim.h
|
||||
HeaderFiles#5=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/usart.h
|
||||
HeaderFiles#6=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/stm32f1xx_it.h
|
||||
HeaderFiles#7=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/stm32f1xx_hal_conf.h
|
||||
HeaderFiles#8=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc/main.h
|
||||
HeaderFolderListSize=1
|
||||
HeaderPath#0=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Inc
|
||||
HeaderPath#0=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Inc
|
||||
HeaderFiles=;
|
||||
SourceFileListSize=10
|
||||
SourceFiles#0=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/gpio.c
|
||||
SourceFiles#1=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/adc.c
|
||||
SourceFiles#2=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/dma.c
|
||||
SourceFiles#3=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/i2c.c
|
||||
SourceFiles#4=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/spi.c
|
||||
SourceFiles#5=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/tim.c
|
||||
SourceFiles#6=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/usart.c
|
||||
SourceFiles#7=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/stm32f1xx_it.c
|
||||
SourceFiles#8=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/stm32f1xx_hal_msp.c
|
||||
SourceFiles#9=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src/main.c
|
||||
SourceFileListSize=9
|
||||
SourceFiles#0=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/gpio.c
|
||||
SourceFiles#1=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/adc.c
|
||||
SourceFiles#2=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/i2c.c
|
||||
SourceFiles#3=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/spi.c
|
||||
SourceFiles#4=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/tim.c
|
||||
SourceFiles#5=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/usart.c
|
||||
SourceFiles#6=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/stm32f1xx_it.c
|
||||
SourceFiles#7=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/stm32f1xx_hal_msp.c
|
||||
SourceFiles#8=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src/main.c
|
||||
SourceFolderListSize=1
|
||||
SourcePath#0=D:/work/platform/wumei-smart/firmware/stm32/smart_dormitory/Core/Src
|
||||
SourcePath#0=D:/work/projects/XiaoYi_IOTKits/product_iotkits_smart_dormitory/device/01.Project_smart_dormitory/Core/Src
|
||||
SourceFiles=;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
/*#define HAL_CORTEX_MODULE_ENABLED */
|
||||
/*#define HAL_CRC_MODULE_ENABLED */
|
||||
/*#define HAL_DAC_MODULE_ENABLED */
|
||||
#define HAL_DMA_MODULE_ENABLED
|
||||
/*#define HAL_DMA_MODULE_ENABLED */
|
||||
/*#define HAL_ETH_MODULE_ENABLED */
|
||||
/*#define HAL_FLASH_MODULE_ENABLED */
|
||||
#define HAL_GPIO_MODULE_ENABLED
|
||||
|
||||
@@ -56,7 +56,7 @@ void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void DMA1_Channel3_IRQHandler(void);
|
||||
void USART3_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "adc.h"
|
||||
#include "dma.h"
|
||||
#include "i2c.h"
|
||||
#include "spi.h"
|
||||
#include "tim.h"
|
||||
@@ -29,15 +28,14 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "esp8266.h"
|
||||
#include "mqtt.h"
|
||||
#include "oled.h"
|
||||
#include "dht11.h"
|
||||
#include "flash.h"
|
||||
#include "esp8266.h"
|
||||
#include "sensor_light.h"
|
||||
#include "rc522.h"
|
||||
#include "process.h"
|
||||
|
||||
#include "mqtt.h"
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
@@ -75,24 +73,6 @@ void delay_ms(int ms)
|
||||
{
|
||||
HAL_Delay(ms);
|
||||
}
|
||||
|
||||
// ESP8266<36><36><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>MCU<43><55><EFBFBD><EFBFBD>
|
||||
int wifi_data_recv_fun(type_recv_e type, uint8_t *data, int len)
|
||||
{
|
||||
switch((int)type)
|
||||
{
|
||||
case TYPE_RECV_DISCONNECT:
|
||||
printf("WIFI DISCONNECT!\r\n");
|
||||
break;
|
||||
case TYPE_RECV_GOT_IP:
|
||||
printf("WIFI GOT IP!\r\n");
|
||||
break;
|
||||
case TYPE_RECV_SUBSCRIBE:
|
||||
printf("recv_fun sucribe data : %s\r\n", data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/**
|
||||
@@ -124,7 +104,6 @@ int main(void)
|
||||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_ADC1_Init();
|
||||
MX_TIM3_Init();
|
||||
MX_USART1_UART_Init();
|
||||
@@ -137,11 +116,11 @@ int main(void)
|
||||
stop_buzz();
|
||||
dht11_init();
|
||||
oled_init();
|
||||
macRC522_Reset_Disable();
|
||||
macRC522_CS_Disable();
|
||||
// macRC522_Reset_Disable();
|
||||
// macRC522_CS_Disable();
|
||||
|
||||
PcdReset();//RC522<32><32>λ
|
||||
M500PcdConfigISOType ( 'A' );//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||
// PcdReset();//RC522<32><32>λ
|
||||
// M500PcdConfigISOType ( 'A' );//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||
|
||||
delay_ms(1000);
|
||||
oled_fill(0xFF);//ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -152,26 +131,21 @@ int main(void)
|
||||
oled_show_string(70, 3, "Humi:", 1);
|
||||
MX_TIM4_Init();
|
||||
|
||||
if (HAL_OK == __HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE)) // ʹ<>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
if (HAL_OK == HAL_UART_Receive_IT(&huart3, &aRxBuffer, 1))
|
||||
{
|
||||
printf("enable uart3 isr\r\n");
|
||||
}
|
||||
HAL_UART_Receive_DMA(&huart3, ESP8266_Fram_Record_Struct.Data_RX_BUF, RX_BUF_MAX_LEN); // <20><><EFBFBD><EFBFBD>DMA<4D><41><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
if (HAL_OK == HAL_TIM_PWM_Start(&htim4,TIM_CHANNEL_1))
|
||||
{
|
||||
printf("enable time4 pwm output\r\n");
|
||||
}
|
||||
set_sg90(50);
|
||||
|
||||
if (HAL_TIM_Base_Start_IT(&htim3))
|
||||
if (HAL_TIM_Base_Start_IT(&htim4))
|
||||
{
|
||||
printf("enable time3 base isr\r\n");
|
||||
}
|
||||
|
||||
ESP8266_Fram_Record_Struct.wifi_data_recv_cb = wifi_data_recv_fun; // <20><><EFBFBD><EFBFBD>ϵͳ<CFB5>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
ESP8266_STA_MQTTClient_Init();
|
||||
printf("ready go into while1\r\n");
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
extern DMA_HandleTypeDef hdma_usart3_rx;
|
||||
extern UART_HandleTypeDef huart3;
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
/* USER CODE END EV */
|
||||
@@ -200,17 +200,29 @@ void SysTick_Handler(void)
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 channel3 global interrupt.
|
||||
* @brief This function handles USART3 global interrupt.
|
||||
*/
|
||||
void DMA1_Channel3_IRQHandler(void)
|
||||
void USART3_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Channel3_IRQn 0 */
|
||||
/* USER CODE BEGIN USART3_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Channel3_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_usart3_rx);
|
||||
/* USER CODE BEGIN DMA1_Channel3_IRQn 1 */
|
||||
/* USER CODE END USART3_IRQn 0 */
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
if(__HAL_UART_GET_FLAG(&huart3,UART_FLAG_IDLE) != RESET)
|
||||
{
|
||||
//һ֡<D2BB><D6A1><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_Fram_Record_Struct.InfBit.FramFinishFlag = 1;
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6>־λ<D6BE><CEBB><EFBFBD>ȶ<EFBFBD>USART_SR,Ȼ<><C8BB><EFBFBD><EFBFBD>USART_DR<44><52>
|
||||
__HAL_UART_CLEAR_IDLEFLAG(&huart3);
|
||||
printf("..............\r\n");
|
||||
}else
|
||||
{
|
||||
HAL_UART_IRQHandler(&huart3);
|
||||
}
|
||||
|
||||
/* USER CODE END DMA1_Channel3_IRQn 1 */
|
||||
/* USER CODE BEGIN USART3_IRQn 1 */
|
||||
|
||||
/* USER CODE END USART3_IRQn 1 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
@@ -30,7 +30,6 @@ extern volatile uint8_t TcpClosedFlag;
|
||||
|
||||
UART_HandleTypeDef huart1;
|
||||
UART_HandleTypeDef huart3;
|
||||
DMA_HandleTypeDef hdma_usart3_rx;
|
||||
|
||||
/* USART1 init function */
|
||||
|
||||
@@ -125,25 +124,8 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USART3 DMA Init */
|
||||
/* USART3_RX Init */
|
||||
hdma_usart3_rx.Instance = DMA1_Channel3;
|
||||
hdma_usart3_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_usart3_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_usart3_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_usart3_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_usart3_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_usart3_rx.Init.Mode = DMA_NORMAL;
|
||||
hdma_usart3_rx.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
if (HAL_DMA_Init(&hdma_usart3_rx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(uartHandle,hdmarx,hdma_usart3_rx);
|
||||
|
||||
/* USART3 interrupt Init */
|
||||
HAL_NVIC_SetPriority(USART3_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(USART3_IRQn, 2, 0);
|
||||
HAL_NVIC_EnableIRQ(USART3_IRQn);
|
||||
/* USER CODE BEGIN USART3_MspInit 1 */
|
||||
__HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE);
|
||||
@@ -186,9 +168,6 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_11);
|
||||
|
||||
/* USART3 DMA DeInit */
|
||||
HAL_DMA_DeInit(uartHandle->hdmarx);
|
||||
|
||||
/* USART3 interrupt Deinit */
|
||||
HAL_NVIC_DisableIRQ(USART3_IRQn);
|
||||
/* USER CODE BEGIN USART3_MspDeInit 1 */
|
||||
@@ -219,44 +198,21 @@ PUTCHAR_PROTOTYPE
|
||||
|
||||
/**
|
||||
* @brief This function handles USART IDLE interrupt.
|
||||
* {
|
||||
"airHumidity":0.0,
|
||||
"airTemperature":0.0,
|
||||
"blue":0,
|
||||
"brightness":11,
|
||||
"createBy":"",
|
||||
"createTime":1627381144000,
|
||||
"deviceId":3,
|
||||
"deviceNum":"E8DB84933089",
|
||||
"deviceStatusId":57,
|
||||
"deviceTemperature":40.0,
|
||||
"fadeTime":259,
|
||||
"green":0,
|
||||
"isOnline":1,
|
||||
"lightInterval":432,
|
||||
"lightMode":0,
|
||||
"lightStatus":1,
|
||||
"params":{},
|
||||
"red":255,
|
||||
"relayStatus":1,
|
||||
"rssi":-54,
|
||||
"triggerSource":0,
|
||||
"updateBy":"",
|
||||
"updateTime":1627381657000}
|
||||
*/
|
||||
void USART3_IRQHandler(void)
|
||||
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
|
||||
{
|
||||
if(__HAL_UART_GET_FLAG(&huart3, UART_FLAG_IDLE) != RESET) // <20><><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6><CFB1>DZ<EFBFBD><C7B1><EFBFBD>λ
|
||||
uint8_t len = 0;
|
||||
|
||||
if(UartHandle->Instance == USART3)
|
||||
{
|
||||
__HAL_UART_CLEAR_IDLEFLAG(&huart3); // <20><><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6><CFB1><EFBFBD>
|
||||
HAL_UART_DMAStop(&huart3); // ֹͣDMA<4D><41><EFBFBD><EFBFBD>
|
||||
ESP8266_Fram_Record_Struct.InfBit.FramLength = RX_BUF_MAX_LEN - __HAL_DMA_GET_COUNTER(huart3.hdmarx); // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥδ<EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_Fram_Record_Struct.Data_RX_BUF[ESP8266_Fram_Record_Struct.InfBit.FramLength] = 0; // <20><><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_Fram_Record_Struct.InfBit.FramFinishFlag = 1; // <20><><EFBFBD>ǽ<EFBFBD><C7BD>ս<EFBFBD><D5BD><EFBFBD>
|
||||
HAL_UART_Receive_DMA(&huart3, ESP8266_Fram_Record_Struct.Data_RX_BUF, RX_BUF_MAX_LEN); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DMA<4D><41><EFBFBD><EFBFBD>
|
||||
if(ESP8266_Fram_Record_Struct.InfBit.FramLength < ( RX_BUF_MAX_LEN - 1 ) )
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һλ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
||||
ESP8266_Fram_Record_Struct.Data_RX_BUF[ ESP8266_Fram_Record_Struct.InfBit.FramLength ++ ] = aRxBuffer;
|
||||
}
|
||||
HAL_UART_Receive_IT(&huart3,&aRxBuffer,1);
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -171,7 +171,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>Application/MDK-ARM</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -238,18 +238,6 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Core/Src/dma.c</PathWithFileName>
|
||||
<FilenameWithoutPath>dma.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Core/Src/i2c.c</PathWithFileName>
|
||||
<FilenameWithoutPath>i2c.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -257,7 +245,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -269,7 +257,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -281,7 +269,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -293,7 +281,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -305,7 +293,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -323,6 +311,18 @@
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\xiaoyi_wifi\tcp.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tcp.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
|
||||
@@ -406,11 +406,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Core/Src/adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Core/Src/dma.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -446,6 +441,11 @@
|
||||
<Group>
|
||||
<GroupName>Application/User/Process</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>tcp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\xiaoyi_wifi\tcp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>mqtt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
38
firmware/stm32/smart_dormitory/MDK-ARM/Project/dma.d
Normal file
38
firmware/stm32/smart_dormitory/MDK-ARM/Project/dma.d
Normal file
@@ -0,0 +1,38 @@
|
||||
project\dma.o: ../Core/Src/dma.c
|
||||
project\dma.o: ../Core/Inc/dma.h
|
||||
project\dma.o: ../Core/Inc/main.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
|
||||
project\dma.o: ../Core/Inc/stm32f1xx_hal_conf.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h
|
||||
project\dma.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h
|
||||
project\dma.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h
|
||||
project\dma.o: ../Drivers/CMSIS/Include/core_cm3.h
|
||||
project\dma.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
project\dma.o: ../Drivers/CMSIS/Include/cmsis_version.h
|
||||
project\dma.o: ../Drivers/CMSIS/Include/cmsis_compiler.h
|
||||
project\dma.o: ../Drivers/CMSIS/Include/cmsis_armcc.h
|
||||
project\dma.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
|
||||
project\dma.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_i2c.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h
|
||||
project\dma.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h
|
||||
project\dma.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdarg.h
|
||||
project\dma.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
project\dma.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,40 +0,0 @@
|
||||
project\tcp.o: ..\User\xiaoyi_wifi\tcp.c
|
||||
project\tcp.o: ..\User\xiaoyi_wifi\tcp.h
|
||||
project\tcp.o: ../Core/Inc/main.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
|
||||
project\tcp.o: ../Core/Inc/stm32f1xx_hal_conf.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h
|
||||
project\tcp.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h
|
||||
project\tcp.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h
|
||||
project\tcp.o: ../Drivers/CMSIS/Include/core_cm3.h
|
||||
project\tcp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
project\tcp.o: ../Drivers/CMSIS/Include/cmsis_version.h
|
||||
project\tcp.o: ../Drivers/CMSIS/Include/cmsis_compiler.h
|
||||
project\tcp.o: ../Drivers/CMSIS/Include/cmsis_armcc.h
|
||||
project\tcp.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
|
||||
project\tcp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_i2c.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h
|
||||
project\tcp.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h
|
||||
project\tcp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdarg.h
|
||||
project\tcp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
project\tcp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
project\tcp.o: ..\User\xiaoyi_wifi\esp8266.h
|
||||
project\tcp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
Binary file not shown.
Binary file not shown.
@@ -5,33 +5,21 @@ ADC1.NbrOfConversionFlag=1
|
||||
ADC1.Rank-2\#ChannelRegularConversion=1
|
||||
ADC1.SamplingTime-2\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5
|
||||
ADC1.master=1
|
||||
Dma.Request0=USART3_RX
|
||||
Dma.RequestsNb=1
|
||||
Dma.USART3_RX.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART3_RX.0.Instance=DMA1_Channel3
|
||||
Dma.USART3_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART3_RX.0.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART3_RX.0.Mode=DMA_NORMAL
|
||||
Dma.USART3_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART3_RX.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART3_RX.0.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART3_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
||||
File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
KeepUserPlacement=false
|
||||
Mcu.Family=STM32F1
|
||||
Mcu.IP0=ADC1
|
||||
Mcu.IP1=DMA
|
||||
Mcu.IP10=USART3
|
||||
Mcu.IP2=I2C1
|
||||
Mcu.IP3=NVIC
|
||||
Mcu.IP4=RCC
|
||||
Mcu.IP5=SPI2
|
||||
Mcu.IP6=SYS
|
||||
Mcu.IP7=TIM3
|
||||
Mcu.IP8=TIM4
|
||||
Mcu.IP9=USART1
|
||||
Mcu.IPNb=11
|
||||
Mcu.IP1=I2C1
|
||||
Mcu.IP2=NVIC
|
||||
Mcu.IP3=RCC
|
||||
Mcu.IP4=SPI2
|
||||
Mcu.IP5=SYS
|
||||
Mcu.IP6=TIM3
|
||||
Mcu.IP7=TIM4
|
||||
Mcu.IP8=USART1
|
||||
Mcu.IP9=USART3
|
||||
Mcu.IPNb=10
|
||||
Mcu.Name=STM32F103C(8-B)Tx
|
||||
Mcu.Package=LQFP48
|
||||
Mcu.Pin0=PC13-TAMPER-RTC
|
||||
@@ -73,7 +61,6 @@ Mcu.UserName=STM32F103C8Tx
|
||||
MxCube.Version=6.0.1
|
||||
MxDb.Version=DB.6.0.0
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.DMA1_Channel3_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
@@ -83,7 +70,7 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:false\:true\:false
|
||||
NVIC.USART3_IRQn=true\:2\:0\:true\:false\:true\:true\:true
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
PA0-WKUP.Locked=true
|
||||
PA0-WKUP.Signal=GPIO_Input
|
||||
@@ -184,7 +171,7 @@ ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=MDK-ARM V5.27
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_USART1_UART_Init-USART1-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_I2C1_Init-I2C1-false-HAL-true,10-MX_SPI2_Init-SPI2-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true,6-MX_USART3_UART_Init-USART3-false-HAL-true,7-MX_TIM4_Init-TIM4-false-HAL-true,8-MX_I2C1_Init-I2C1-false-HAL-true,9-MX_SPI2_Init-SPI2-false-HAL-true
|
||||
RCC.ADCFreqValue=12000000
|
||||
RCC.ADCPresc=RCC_ADCPCLK2_DIV6
|
||||
RCC.AHBFreq_Value=72000000
|
||||
|
||||
@@ -21,8 +21,6 @@ void start_buzz(void);
|
||||
|
||||
void stop_buzz(void);
|
||||
|
||||
void set_sg90(int value);
|
||||
|
||||
void process_local_handle(uint16_t value_humi);
|
||||
|
||||
void process_report_data(void);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#include "esp8266.h"
|
||||
#include "usart.h"
|
||||
|
||||
extern UART_HandleTypeDef huart3;
|
||||
|
||||
STRUCT_USART_Fram_t ESP8266_Fram_Record_Struct;
|
||||
|
||||
struct STRUCT_USART_Fram ESP8266_Fram_Record_Struct= { 0 }; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
void ESP8266_Init(uint32_t bound)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
@@ -18,7 +17,7 @@ void ESP8266_Init(uint32_t bound)
|
||||
// GPIO_InitStructure.Pin = ESP8266_CH_PD_Pin;
|
||||
// HAL_GPIO_Init(ESP8266_CH_PD_Pin_Port, &GPIO_InitStructure);
|
||||
//
|
||||
// ESP8266_Rst();
|
||||
ESP8266_Rst();
|
||||
}
|
||||
|
||||
//<2F><>ESP8266ģ<36>鷢<EFBFBD><E9B7A2>ATָ<54><D6B8>
|
||||
@@ -28,11 +27,8 @@ void ESP8266_Init(uint32_t bound)
|
||||
//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD>ͳɹ<CDB3><C9B9><EFBFBD> 0ʧ<30><CAA7>
|
||||
bool ESP8266_Send_AT_Cmd(char *cmd,char *ack1,char *ack2,uint32_t time)
|
||||
{
|
||||
ESP8266_Fram_Record_Struct.InfBit.FramLength = 0; //<2F><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
||||
ESP8266_Fram_Record_Struct.InfBit.FramFinishFlag = 0;
|
||||
memset(ESP8266_Fram_Record_Struct.Data_RX_BUF, 0x00, sizeof(ESP8266_Fram_Record_Struct.Data_RX_BUF));
|
||||
|
||||
hal_AT_printf("%s\r\n", cmd);
|
||||
ESP8266_Fram_Record_Struct.InfBit .FramLength = 0; //<2F><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
||||
ESP8266_USART("%s\r\n", cmd);
|
||||
if(ack1==0&&ack2==0) //<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
return true;
|
||||
@@ -44,36 +40,35 @@ bool ESP8266_Send_AT_Cmd(char *cmd,char *ack1,char *ack2,uint32_t time)
|
||||
printf("------ %s", ESP8266_Fram_Record_Struct.Data_RX_BUF);
|
||||
if(ack1!=0&&ack2!=0)
|
||||
{
|
||||
return ( ( bool ) strstr ( (char *)ESP8266_Fram_Record_Struct.Data_RX_BUF, ack1 ) ||
|
||||
( bool ) strstr ( (char *)ESP8266_Fram_Record_Struct.Data_RX_BUF, ack2 ) );
|
||||
return ( ( bool ) strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, ack1 ) ||
|
||||
( bool ) strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, ack2 ) );
|
||||
}
|
||||
else if( ack1 != 0 ) //strstr(s1,s2);<3B><><EFBFBD><EFBFBD>s2<73>Ƿ<EFBFBD>Ϊs1<73><31>һ<EFBFBD><D2BB><EFBFBD>֣<EFBFBD><D6A3>Ƿ<EFBFBD><C7B7>ظ<EFBFBD>λ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>false<73><65><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>ת<EFBFBD><D7AA>Ϊbool<6F><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return ( ( bool ) strstr ( (char *)ESP8266_Fram_Record_Struct.Data_RX_BUF, ack1 ) );
|
||||
return ( ( bool ) strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, ack1 ) );
|
||||
|
||||
else
|
||||
return ( ( bool ) strstr ( (char *)ESP8266_Fram_Record_Struct.Data_RX_BUF, ack2 ) );
|
||||
|
||||
return ( ( bool ) strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, ack2 ) );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*/
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>WiFi<46><69>λ */
|
||||
/*<2A><> <20><><EFBFBD><EFBFBD>timeout<75><74><EFBFBD><EFBFBD>ʱʱ<CAB1>䣨100ms<6D>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0<EFBFBD><30><EFBFBD><EFBFBD>ȷ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*-------------------------------------------------*/
|
||||
|
||||
char ESP8266_Rst(void)
|
||||
//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
void ESP8266_Rst(void)
|
||||
{
|
||||
return ESP8266_Send_AT_Cmd ( "AT+RST\r\n", "OK", 0, 5000 );
|
||||
// ESP8266_RST_Pin_SetL;
|
||||
// delay_ms(500);
|
||||
// ESP8266_RST_Pin_SetH;
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
//<2F><><EFBFBD>ͻָ<CDBB><D6B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ģ<EEBDAB><C4A3><EFBFBD>ָ<EFBFBD><D6B8>ɳ<EFBFBD><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void ESP8266_AT_Test(void)
|
||||
void ESP8266_ATE0(void)
|
||||
{
|
||||
char count=0;
|
||||
delay_ms(1000);
|
||||
while(count < 10)
|
||||
{
|
||||
if(ESP8266_Send_AT_Cmd("AT+RESTORE","OK",NULL,500))
|
||||
if(ESP8266_Send_AT_Cmd("ATE0","OK",NULL,500))
|
||||
{
|
||||
printf("OK\r\n");
|
||||
return;
|
||||
@@ -82,16 +77,16 @@ void ESP8266_AT_Test(void)
|
||||
}
|
||||
}
|
||||
|
||||
//ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void ESP8266_ATE0(void)
|
||||
//<EFBFBD><EFBFBD><EFBFBD>ͻָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>ɳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void ESP8266_AT_Restore(void)
|
||||
{
|
||||
char count=0;
|
||||
delay_ms(1000);
|
||||
while(count < 10)
|
||||
{
|
||||
if(ESP8266_Send_AT_Cmd("ATE0","OK",NULL,1000))
|
||||
if(ESP8266_Send_AT_Cmd("AT+RESTORE","OK",NULL,500))
|
||||
{
|
||||
printf("ATE0 OK\r\n");
|
||||
printf("OK\r\n");
|
||||
return;
|
||||
}
|
||||
++ count;
|
||||
@@ -119,6 +114,7 @@ bool ESP8266_Net_Mode_Choose(ENUM_Net_ModeTypeDef enumMode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//ESP8266<36><36><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF>WIFI
|
||||
//pSSID WiFi<46>ʺ<EFBFBD>
|
||||
//pPassWord WiFi<46><69><EFBFBD><EFBFBD>
|
||||
@@ -128,7 +124,7 @@ bool ESP8266_JoinAP( char * pSSID, char * pPassWord)
|
||||
char cCmd [120];
|
||||
|
||||
sprintf ( cCmd, "AT+CWJAP=\"%s\",\"%s\"", pSSID, pPassWord );
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", "WIFI CONNECTED", 5000 );
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 5000 );
|
||||
}
|
||||
|
||||
//ESP8266 <><CDB8>ʹ<EFBFBD><CAB9>
|
||||
@@ -144,18 +140,6 @@ bool ESP8266_Enable_MultipleId (FunctionalState enumEnUnvarnishTx )
|
||||
|
||||
}
|
||||
|
||||
//ESP8266 ʹ<><CAB9><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
||||
//enumEnUnvarnishTx <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>bool<6F><6C><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true<75><65><EFBFBD><EFBFBD>֮false
|
||||
bool ESP8266_Enable_AutoConnect (int enable )
|
||||
{
|
||||
char cStr [20];
|
||||
|
||||
sprintf ( cStr, "AT+CWAUTOCONN=%d", enable );
|
||||
|
||||
return ESP8266_Send_AT_Cmd ( cStr, "OK", 0, 500 );
|
||||
|
||||
}
|
||||
|
||||
//ESP8266 <20><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
//enumE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -201,6 +185,7 @@ bool ESP8266_UnvarnishSend ( void )
|
||||
|
||||
return
|
||||
ESP8266_Send_AT_Cmd( "AT+CIPSEND", "OK", ">", 500 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -215,17 +200,18 @@ bool ESP8266_SendString(FunctionalState enumEnUnvarnishTx, char * pStr, uint32_t
|
||||
char cStr [20];
|
||||
bool bRet = false;
|
||||
|
||||
|
||||
if ( enumEnUnvarnishTx )
|
||||
{
|
||||
hal_AT_printf ( "%s", pStr );
|
||||
ESP8266_USART ( "%s", pStr );
|
||||
|
||||
bRet = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ucId < 5 )
|
||||
sprintf ( cStr, "AT+CIPSEND=%d,%d", ucId, ulStrLength + 2 );
|
||||
|
||||
else
|
||||
sprintf ( cStr, "AT+CIPSEND=%d", ulStrLength + 2 );
|
||||
|
||||
@@ -233,7 +219,9 @@ bool ESP8266_SendString(FunctionalState enumEnUnvarnishTx, char * pStr, uint32_t
|
||||
|
||||
bRet = ESP8266_Send_AT_Cmd ( pStr, "SEND OK", 0, 1000 );
|
||||
}
|
||||
|
||||
return bRet;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +229,7 @@ bool ESP8266_SendString(FunctionalState enumEnUnvarnishTx, char * pStr, uint32_t
|
||||
void ESP8266_ExitUnvarnishSend ( void )
|
||||
{
|
||||
delay_ms(1000);
|
||||
hal_AT_printf( "+++" );
|
||||
ESP8266_USART( "+++" );
|
||||
delay_ms( 500 );
|
||||
}
|
||||
|
||||
@@ -255,89 +243,20 @@ uint8_t ESP8266_Get_LinkStatus ( void )
|
||||
{
|
||||
if (ESP8266_Send_AT_Cmd( "AT+CIPSTATUS", "OK", 0, 500 ) )
|
||||
{
|
||||
if ( strstr ( (char *)ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:2\r\n" ) )
|
||||
if ( strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:2\r\n" ) )
|
||||
return 2;
|
||||
else if ( strstr ( (char *)ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:3\r\n" ) )
|
||||
|
||||
else if ( strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:3\r\n" ) )
|
||||
return 3;
|
||||
else if ( strstr ( (char *)ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:4\r\n" ) )
|
||||
|
||||
else if ( strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:4\r\n" ) )
|
||||
return 4;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern char mqtt_tcp_connect(int timeout);
|
||||
|
||||
/*-------------------------------------------------*/
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>WiFi<46><69><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*<2A><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0<EFBFBD><30><EFBFBD><EFBFBD>ȷ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*-------------------------------------------------*/
|
||||
char WiFi_Connect_IoTServer(void)
|
||||
{
|
||||
// printf("<><D7BC><EFBFBD><EFBFBD>λģ<CEBB><C4A3>\r\n"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
// ESP8266_Rst();
|
||||
|
||||
// ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_ATE0();
|
||||
|
||||
printf("ready to set STA mode\r\n");
|
||||
// <20><><EFBFBD><EFBFBD>STAģʽ
|
||||
if (ESP8266_Net_Mode_Choose(STA))
|
||||
{
|
||||
printf("Set STA mode\r\n");
|
||||
}
|
||||
|
||||
// <><D7BC><EFBFBD>رն<D8B1>·<EFBFBD><C2B7><EFBFBD><EFBFBD>
|
||||
if (ESP8266_Enable_MultipleId(DISABLE))
|
||||
{
|
||||
printf("close multipled ID success\r\n");
|
||||
}else
|
||||
{
|
||||
printf("close multipled ID error\r\n");
|
||||
}
|
||||
// ȡ<><C8A1><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(ESP8266_Enable_AutoConnect(0)) //ȡ<><C8A1><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ӣ<EFBFBD>100ms<6D><73>ʱ<EFBFBD><CAB1>λ<EFBFBD><CEBB><EFBFBD>ܼ<EFBFBD>5s<35><73>ʱʱ<CAB1><CAB1>
|
||||
{
|
||||
printf("ȡ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD>\r\n"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
}else
|
||||
{
|
||||
printf("ȡ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n"); //<2F><><EFBFBD>ط<EFBFBD>0ֵ<30><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>if<69><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>
|
||||
if(ESP8266_JoinAP(User_SSID, User_PWD))
|
||||
{
|
||||
printf("connect to router success\r\n");
|
||||
}else
|
||||
{
|
||||
printf("connect to router failed\r\n");
|
||||
return 9;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(mqtt_tcp_connect(500)) //<2F><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>100ms<6D><73>ʱ<EFBFBD><CAB1>λ<EFBFBD><CEBB><EFBFBD>ܼ<EFBFBD>10s<30><73>ʱʱ<CAB1><CAB1>
|
||||
{
|
||||
printf("connect to server success\r\n"); //<2F><><EFBFBD>ط<EFBFBD>0ֵ<30><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>if<69><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD>10
|
||||
}else
|
||||
{
|
||||
printf("connect to server failed\r\n"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
return 10;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><CDB8>ģʽ
|
||||
if (ESP8266_UnvarnishSend() )
|
||||
{
|
||||
printf("go into unvarnishSend mode\r\n");
|
||||
}
|
||||
return 0; //<2F><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>0
|
||||
}
|
||||
|
||||
|
||||
static char *itoa( int value, char *string, int radix )
|
||||
{
|
||||
int i, d;
|
||||
@@ -388,7 +307,7 @@ static char *itoa( int value, char *string, int radix )
|
||||
} /* NCL_Itoa */
|
||||
|
||||
|
||||
void hal_AT_printf ( char * Data, ... )
|
||||
void USART_printf ( char * Data, ... )
|
||||
{
|
||||
const char *s;
|
||||
int d;
|
||||
@@ -459,7 +378,101 @@ void hal_AT_printf ( char * Data, ... )
|
||||
Data++;
|
||||
while( __HAL_UART_GET_FLAG(&huart3, UART_FLAG_TXE) == false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ΪESP8266MQTT<54><54><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||
|
||||
/*
|
||||
*MQTT<54><54><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*scheme <20><><EFBFBD>ӷ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>MQTT over TCP,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1
|
||||
*client_id MQTTclientID <20><><EFBFBD>ڱ<EFBFBD>־client<6E><74><EFBFBD><EFBFBD>
|
||||
*username <20><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> username
|
||||
*password <20><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> password
|
||||
*cert_key_ID ֤<><D6A4> ID, Ŀǰ֧<C7B0><D6A7>һ<EFBFBD><D2BB> cert ֤<><D6A4>, <20><><EFBFBD><EFBFBD>Ϊ 0
|
||||
*CA_ID Ŀǰ֧<C7B0><D6A7>һ<EFBFBD><D2BB> CA ֤<><D6A4>, <20><><EFBFBD><EFBFBD>Ϊ 0
|
||||
*path <20><>Դ·<D4B4><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ""
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTUSERCFG( char * pClient_Id, char * pUserName,char * PassWord)
|
||||
{
|
||||
char cCmd [120];
|
||||
sprintf ( cCmd, "AT+MQTTUSERCFG=0,1,\"%s\",\"%s\",\"%s\",0,0,\"\"", pClient_Id,pUserName,PassWord );
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 500 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*<2A><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*IP<49><50>MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>Ӧ<EFBFBD><D3A6>IP<49><50>ַ
|
||||
*ComNum MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>Ӧ<EFBFBD>Ķ˿ںţ<DABA>һ<EFBFBD><D2BB>Ϊ1883
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTCONN( char * Ip, int Num)
|
||||
{
|
||||
char cCmd [120];
|
||||
sprintf ( cCmd,"AT+MQTTCONN=0,\"%s\",%d,0", Ip,Num);
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 500 );
|
||||
}
|
||||
|
||||
/*
|
||||
*<2A><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD> MQTT <20><><EFBFBD><EFBFBD>, <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD>ζ<EFBFBD><CEB6>IJ<EFBFBD>ͬ topic
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*Topic <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪTopic
|
||||
*Qosֵ<73><D6B5>һ<EFBFBD><D2BB>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTSUB(char * Topic)
|
||||
{
|
||||
char cCmd [120];
|
||||
sprintf ( cCmd, "AT+MQTTSUB=0,\"%s\",1",Topic );
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 500 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*<2A><>LinkID<49><44>ͨ<EFBFBD><CDA8> topic <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> data, <20><><EFBFBD><EFBFBD> data Ϊ<>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*Topic <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪTopic
|
||||
*data<74><61><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTPUB( char * Topic,char *temp)
|
||||
{
|
||||
char cCmd [512];
|
||||
sprintf (cCmd, "AT+MQTTPUB=0,\"%s\",\"%s\",0,0", Topic ,temp);
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 1000 );
|
||||
}
|
||||
|
||||
/*
|
||||
*<2A>ر<EFBFBD> MQTT Client Ϊ LinkID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ͷ<EFBFBD><CDB7>ڲ<EFBFBD>ռ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Դ
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*Topic <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪTopic
|
||||
*data<74><61><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTCLEAN(void)
|
||||
{
|
||||
char cCmd [120];
|
||||
sprintf ( cCmd, "AT+MQTTCLEAN=0");
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 500 );
|
||||
}
|
||||
|
||||
//ESP8266<36><36><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
//enumEnUnvarnishTx<54>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><CDB8>ģʽ
|
||||
//pStr<74>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
//ulStrLength<74>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//ucId <20><><EFBFBD>Ӻ<EFBFBD>
|
||||
//<2F><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true<75><65> <20><>֮false
|
||||
bool MQTT_SendString(char * pTopic,char *temp2)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
bRet = ESP8266_MQTTPUB(pTopic,temp2);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef __ESP8266_H__
|
||||
#define __ESP8266_H__
|
||||
#ifndef __ESP8266_H
|
||||
#define __ESP8266_H
|
||||
|
||||
#include "main.h"
|
||||
|
||||
@@ -7,6 +7,33 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
#pragma anon_unions
|
||||
#endif
|
||||
|
||||
//ESP8266ģʽѡ<CABD><D1A1>
|
||||
typedef enum
|
||||
{
|
||||
STA,
|
||||
AP,
|
||||
STA_AP
|
||||
}ENUM_Net_ModeTypeDef;
|
||||
|
||||
//<2F><><EFBFBD>紫<EFBFBD><E7B4AB><EFBFBD><EFBFBD>Э<EFBFBD>飬ö<E9A3AC><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef enum{
|
||||
enumTCP,
|
||||
enumUDP,
|
||||
} ENUM_NetPro_TypeDef;
|
||||
//<2F><><EFBFBD>Ӻţ<D3BA>ָ<EFBFBD><D6B8>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>Ӻſ<D3BA><C5BF>Է<EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<CDAC>˿ڶ<CBBF><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef enum{
|
||||
Multiple_ID_0 = 0,
|
||||
Multiple_ID_1 = 1,
|
||||
Multiple_ID_2 = 2,
|
||||
Multiple_ID_3 = 3,
|
||||
Multiple_ID_4 = 4,
|
||||
Single_ID_0 = 5,
|
||||
} ENUM_ID_NO_TypeDef;
|
||||
|
||||
#define ESP8266_RST_Pin GPIO_PIN_4 //<2F><>λ<EFBFBD>ܽ<EFBFBD>
|
||||
#define ESP8266_RST_Pin_Port GPIOA //<2F><>λ
|
||||
|
||||
@@ -26,62 +53,11 @@
|
||||
#define PC_USART(fmt, ...) printf(fmt, ##__VA_ARGS__) //<2F><><EFBFBD>Ǵ<EFBFBD><C7B4>ڴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>ִ<EFBFBD><D6B4>printf<74><66><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ִ<EFBFBD><D6B4>fput<75><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>printf<74><66>
|
||||
|
||||
|
||||
|
||||
#define RX_BUF_MAX_LEN 1024 //<2F><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
|
||||
#define User_SSID "brown1" //wifi<66><69>
|
||||
#define User_PWD "123456789a" //wifi<66><69><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
//ESP8266ģʽѡ<CABD><D1A1>
|
||||
typedef enum
|
||||
extern struct STRUCT_USART_Fram //<2F><><EFBFBD><EFBFBD>֡<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
{
|
||||
STA,
|
||||
AP,
|
||||
STA_AP
|
||||
}ENUM_Net_ModeTypeDef;
|
||||
|
||||
//<2F><><EFBFBD>紫<EFBFBD><E7B4AB><EFBFBD><EFBFBD>Э<EFBFBD>飬ö<E9A3AC><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef enum{
|
||||
enumTCP,
|
||||
enumUDP,
|
||||
} ENUM_NetPro_TypeDef;
|
||||
|
||||
//<2F><><EFBFBD>Ӻţ<D3BA>ָ<EFBFBD><D6B8>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>Ӻſ<D3BA><C5BF>Է<EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<CDAC>˿ڶ<CBBF><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef enum{
|
||||
Multiple_ID_0 = 0,
|
||||
Multiple_ID_1 = 1,
|
||||
Multiple_ID_2 = 2,
|
||||
Multiple_ID_3 = 3,
|
||||
Multiple_ID_4 = 4,
|
||||
Single_ID_0 = 5,
|
||||
} ENUM_ID_NO_TypeDef;
|
||||
|
||||
|
||||
//ESP8266<36><36><EFBFBD><EFBFBD>״̬
|
||||
typedef enum{
|
||||
NET_STATUS_INIT = 0,
|
||||
NET_STATUS_WIFI_CONNECTING,
|
||||
NET_STATUS_WIFI_CONNECTED,
|
||||
NET_STATUS_WIFI_FAILED,
|
||||
NET_STATUS_CLOUD_SUCCESS,
|
||||
NET_STATUS_CLOUD_FAIL,
|
||||
}connect_status_e;
|
||||
|
||||
//ESP8266<36><36><EFBFBD><EFBFBD>״̬
|
||||
typedef enum{
|
||||
TYPE_RECV_CONNECT = 0,
|
||||
TYPE_RECV_DISCONNECT,
|
||||
TYPE_RECV_GOT_IP,
|
||||
TYPE_RECV_SUBSCRIBE, // <20><><EFBFBD><EFBFBD>MQTT<54>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
TYPE_RECV_NONE,
|
||||
}type_recv_e;
|
||||
|
||||
typedef int (*wifi_data_arrvied)(type_recv_e type, uint8_t *data, int len); // <20><><EFBFBD><EFBFBD>ָ<EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD>WIFI<46><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#pragma anon_unions
|
||||
typedef struct STRUCT_USART_Fram //<2F><><EFBFBD><EFBFBD>֡<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
{
|
||||
uint8_t Data_RX_BUF[RX_BUF_MAX_LEN];
|
||||
char Data_RX_BUF[RX_BUF_MAX_LEN];
|
||||
union
|
||||
{
|
||||
__IO uint16_t InfAll;
|
||||
@@ -91,17 +67,15 @@ typedef struct STRUCT_USART_Fram //
|
||||
__IO uint16_t FramFinishFlag :1; // 15
|
||||
}InfBit;
|
||||
};
|
||||
wifi_data_arrvied wifi_data_recv_cb;
|
||||
|
||||
}STRUCT_USART_Fram_t;
|
||||
extern STRUCT_USART_Fram_t ESP8266_Fram_Record_Struct;
|
||||
}ESP8266_Fram_Record_Struct;
|
||||
|
||||
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>TCP<43><50><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD>
|
||||
void ESP8266_Init(uint32_t bound);
|
||||
void ESP8266_AT_Test(void);
|
||||
void ESP8266_ATE0(void);
|
||||
bool ESP8266_Send_AT_Cmd(char *cmd,char *ack1,char *ack2,uint32_t time);
|
||||
char ESP8266_Rst(void);
|
||||
void ESP8266_Rst(void);
|
||||
bool ESP8266_Net_Mode_Choose(ENUM_Net_ModeTypeDef enumMode);
|
||||
bool ESP8266_JoinAP( char * pSSID, char * pPassWord );
|
||||
bool ESP8266_Enable_MultipleId ( FunctionalState enumEnUnvarnishTx );
|
||||
@@ -110,8 +84,15 @@ bool ESP8266_SendString(FunctionalState enumEnUnvarnishTx, char * pStr, uint32_t
|
||||
bool ESP8266_UnvarnishSend ( void );
|
||||
void ESP8266_ExitUnvarnishSend ( void );
|
||||
uint8_t ESP8266_Get_LinkStatus ( void );
|
||||
void hal_AT_printf( char * Data, ... );
|
||||
char WiFi_Connect_IoTServer(void);
|
||||
void USART_printf( char * Data, ... );
|
||||
|
||||
//MQTT<54><54><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD>
|
||||
bool ESP8266_MQTTUSERCFG( char * pClient_Id, char * pUserName,char * PassWord);
|
||||
bool ESP8266_MQTTCONN( char * Ip, int Num);
|
||||
bool ESP8266_MQTTSUB(char * Topic);
|
||||
bool ESP8266_MQTTPUB( char * Topic,char *temp);
|
||||
bool ESP8266_MQTTCLEAN(void);
|
||||
bool MQTT_SendString(char * pTopic,char *temp2);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,340 +1,37 @@
|
||||
#include "mqtt.h"
|
||||
#include "usart.h"
|
||||
|
||||
char str[] = "{\"deviceNum\": \"E8DB84933089\",\"relayStatus\": 0,\"lightStatus\": 0,\"isOnline\": 1,\"rssi\": -54,\"deviceTemperature\": 38}";
|
||||
|
||||
static int mqtt_send(uint8_t head, uint32_t vlen, uint8_t *vhead,
|
||||
uint32_t pay_len, uint8_t *payload)
|
||||
void ESP8266_STA_MQTTClient_Init(void)
|
||||
{
|
||||
int32_t tmp_encode, tmp_x;
|
||||
uint32_t i = 0;
|
||||
uint8_t msg[RX_BUF_MAX_LEN];
|
||||
msg[i++] = head;
|
||||
char str[] = "{\"deviceNum\":\"863488052352477\"\,\"relayStatus\":0\,\
|
||||
\"lightStatus\":0\,\"isOnline\":1\,\"rssi\":-54\,\"deviceTemperature\":40\,\"airTemperature\":0\,\
|
||||
\"airHumidity\":0\,\"triggerSource\":0\,\"brightness\":11\,\"lightInterval\":432\,\
|
||||
\"lightMode\":0\,\"fadeTime\":259\,\"red\":255\,\"green\":0\,\"blue\":0}";
|
||||
|
||||
tmp_x = vlen + pay_len;
|
||||
do {
|
||||
tmp_encode = tmp_x % 128;
|
||||
tmp_x = tmp_x / 128;
|
||||
if (tmp_x > 0) {
|
||||
tmp_encode = tmp_encode | 128;
|
||||
}
|
||||
msg[i++] = tmp_encode;
|
||||
} while (tmp_x > 0);
|
||||
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ESP8266<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n");
|
||||
ESP8266_ATE0();//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_Net_Mode_Choose(STA);
|
||||
while(!ESP8266_JoinAP(WIFI_SSID, WIFI_PWD));
|
||||
|
||||
if (vlen != 0) {
|
||||
memcpy(&msg[i], vhead, vlen);
|
||||
i = i + vlen;
|
||||
}
|
||||
if (pay_len != 0) {
|
||||
memcpy(&msg[i], payload, pay_len);
|
||||
i = i + pay_len;
|
||||
}
|
||||
ESP8266_Fram_Record_Struct.InfBit.FramFinishFlag = 0;
|
||||
ESP8266_Fram_Record_Struct.InfBit.FramLength = 0;
|
||||
HAL_UART_Transmit(&huart3, msg, i, 0xFFFF);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_MQTTUSERCFG(WIFI_client_id,WIFI_username,WIFI_password);
|
||||
delay_ms(200);
|
||||
// <20><><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_MQTTCONN( WIFI_MQTTServer_IP, WIFI_MQTTServer_PORT);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_MQTTSUB( WIFI_MQTTServer_Topic_SUB);
|
||||
printf("\r\nMQTT<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
|
||||
return 0;
|
||||
}
|
||||
delay_ms(200);
|
||||
|
||||
static int mqtt_str_fill(uint8_t *outbuff, char *instr)
|
||||
{
|
||||
uint8_t *p_tmp;
|
||||
p_tmp = &outbuff[2];
|
||||
outbuff[0] = strlen(instr) / 256;
|
||||
outbuff[1] = strlen(instr) % 256;
|
||||
strcpy((char*) p_tmp, (char*) instr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mqtt_recv(uint8_t *ackbuff, uint16_t *ack_len, int timeout)
|
||||
{
|
||||
do {
|
||||
if(1 == ESP8266_Fram_Record_Struct.InfBit.FramFinishFlag)
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (MQTT_SendString (WIFI_MQTTServer_Topic_PUB, str))
|
||||
{
|
||||
memcpy(ackbuff, ESP8266_Fram_Record_Struct.Data_RX_BUF, ESP8266_Fram_Record_Struct.InfBit.FramLength);
|
||||
*ack_len = ESP8266_Fram_Record_Struct.InfBit.FramLength;
|
||||
ESP8266_Fram_Record_Struct.InfBit.FramFinishFlag = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (timeout > 0) {
|
||||
HAL_Delay(100);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} while (timeout--);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int mqtt_ack_check(uint8_t head, int timeout, uint16_t msg_id)
|
||||
{
|
||||
uint8_t recv_head;
|
||||
uint8_t recv_buff[RX_BUF_MAX_LEN];
|
||||
uint16_t recv_len;
|
||||
|
||||
if (mqtt_recv(recv_buff, &recv_len, timeout) != 0) {
|
||||
return -1;
|
||||
}
|
||||
recv_head = recv_buff[0];
|
||||
|
||||
if ((head & recv_head) != head) {
|
||||
return -1;
|
||||
}
|
||||
switch (recv_head & 0xF0) {
|
||||
case MQTT_CONNACK:
|
||||
return 0;
|
||||
case MQTT_PUBACK:
|
||||
return 0;
|
||||
case MQTT_SUBACK:
|
||||
return 0;
|
||||
case MQTT_PINGRESP:
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*/
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*<2A><> <20><><EFBFBD><EFBFBD>timeout<75><74> <20><>ʱʱ<CAB1>䣨100ms<6D>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>True<75><65><EFBFBD><EFBFBD>ȷ False<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*-------------------------------------------------*/
|
||||
char mqtt_tcp_connect(int timeout)
|
||||
{
|
||||
char cCmd [120];
|
||||
|
||||
sprintf (cCmd, "AT+CIPSTART=\"TCP\",\"%s\",%d\r\n", User_MQTTServer_IP, User_MQTTServer_PORT);
|
||||
|
||||
return ESP8266_Send_AT_Cmd ( cCmd, "OK", "WIFI GOT IP", timeout);
|
||||
}
|
||||
|
||||
static int mqtt_connect(char *name, char *pwd, char *client_id)
|
||||
{
|
||||
uint32_t i, j;
|
||||
uint8_t vhead[512];
|
||||
uint8_t payload[512];
|
||||
uint8_t connec_flag = 0;
|
||||
uint8_t head;
|
||||
uint16_t keep_alive = 60;
|
||||
|
||||
i = 0;
|
||||
vhead[i++] = 0;
|
||||
vhead[i++] = 4;
|
||||
vhead[i++] = 'M';
|
||||
vhead[i++] = 'Q';
|
||||
vhead[i++] = 'T';
|
||||
vhead[i++] = 'T';
|
||||
vhead[i++] = 4;
|
||||
|
||||
if (name != NULL) {
|
||||
connec_flag = connec_flag | CONNECT_FLAG_NAME;
|
||||
}
|
||||
if (pwd != NULL) {
|
||||
connec_flag = connec_flag | CONNECT_FLAG_PWD;
|
||||
}
|
||||
vhead[i++] = connec_flag;
|
||||
vhead[i++] = keep_alive / 256;
|
||||
vhead[i++] = keep_alive % 256;
|
||||
|
||||
j = 0;
|
||||
mqtt_str_fill(&payload[j], client_id);
|
||||
j = j + strlen(client_id) + 2;
|
||||
mqtt_str_fill(&payload[j], name);
|
||||
j = j + strlen(name) + 2;
|
||||
mqtt_str_fill(&payload[j], pwd);
|
||||
j = j + strlen(pwd) + 2;
|
||||
|
||||
head = MQTT_CONNECT;
|
||||
|
||||
mqtt_send(head, i, vhead, j, payload);
|
||||
if (mqtt_ack_check(MQTT_CONNACK, 100, 0) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mqtt_disconnect(void)
|
||||
{
|
||||
uint8_t head;
|
||||
head = MQTT_DISCONNECT;
|
||||
mqtt_send(head, 0, NULL, 0, NULL);
|
||||
}
|
||||
static int mqtt_publish(char *topic, uint8_t *msg, uint16_t msg_len,
|
||||
uint16_t msg_id)
|
||||
{
|
||||
uint32_t i, j;
|
||||
uint8_t vhead[512];
|
||||
uint8_t head;
|
||||
uint8_t payload[512];
|
||||
|
||||
head = 0;
|
||||
head = head | MQTT_PUBLISH;
|
||||
head = head | PUBLISH_FLAG_RETN;
|
||||
head = head | PUBLISH_FLAG_QOS1;
|
||||
|
||||
i = 0;
|
||||
mqtt_str_fill(&vhead[i], topic);
|
||||
i = i + strlen(topic) + 2;
|
||||
vhead[i++] = msg_id >> 8;
|
||||
vhead[i++] = msg_id;
|
||||
|
||||
j = 0;
|
||||
memcpy(payload, msg, msg_len);
|
||||
j = j + msg_len;
|
||||
|
||||
mqtt_send(head, i, vhead, j, payload);
|
||||
|
||||
if (mqtt_ack_check(MQTT_PUBACK, 100, msg_id) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mqtt_publish_ack(uint16_t msg_id)
|
||||
{
|
||||
uint32_t i, j;
|
||||
uint8_t vhead[512];
|
||||
uint8_t head;
|
||||
uint8_t payload[512];
|
||||
head = MQTT_PUBACK;
|
||||
i = 0;
|
||||
vhead[i++] = msg_id >> 8;
|
||||
vhead[i++] = msg_id;
|
||||
j = 0;
|
||||
mqtt_send(head, i, vhead, j, payload);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mqtt_subscriber(char *topic, uint16_t msg_id)
|
||||
{
|
||||
uint32_t i, j;
|
||||
uint8_t vhead[512];
|
||||
uint8_t payload[512];
|
||||
uint8_t head;
|
||||
head = MQTT_SUBSCRIBE;
|
||||
head = head | 0x02;
|
||||
i = 0;
|
||||
vhead[i++] = msg_id >> 8;
|
||||
vhead[i++] = msg_id;
|
||||
|
||||
j = 0;
|
||||
mqtt_str_fill(&payload[j], topic);
|
||||
j = j + strlen(topic) + 2;
|
||||
payload[j++] = 1;
|
||||
mqtt_send(head, i, vhead, j, payload);
|
||||
if (mqtt_ack_check(MQTT_SUBACK, 100, msg_id) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mqtt_publish_from_cloud(uint8_t *ackbuff, uint16_t ack_len)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
uint16_t multiplier = 1;
|
||||
uint32_t remain_len = 0;
|
||||
uint32_t vhead_len;
|
||||
uint32_t payload_len;
|
||||
uint8_t byte;
|
||||
uint8_t payload[512];
|
||||
uint16_t msg_id;
|
||||
uint8_t topic[256];
|
||||
i = 1;
|
||||
|
||||
memset(topic, 0, 256);
|
||||
memset(payload, 0, 256);
|
||||
do {
|
||||
byte = ackbuff[i++];
|
||||
remain_len += (byte & 0x7F) * multiplier;
|
||||
multiplier *= 128;
|
||||
if (multiplier > 128 * 128 * 128) {
|
||||
return -1;
|
||||
}
|
||||
} while ((byte & 0x80) != 0);
|
||||
vhead_len = ackbuff[i++];
|
||||
vhead_len = (vhead_len * 256) + ackbuff[i++];
|
||||
memcpy(topic, &ackbuff[i], vhead_len);
|
||||
|
||||
i = i + vhead_len;
|
||||
msg_id = ackbuff[i++];
|
||||
msg_id = (msg_id * 256) + ackbuff[i++];
|
||||
|
||||
payload_len = remain_len - vhead_len - 4;
|
||||
|
||||
memcpy(payload, &ackbuff[i], payload_len);
|
||||
if (strcmp((char*) topic, User_MQTTServer_Topic_SUB) == 0) {
|
||||
// sensor_data_set(payload);
|
||||
;
|
||||
}
|
||||
mqtt_publish_ack(msg_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t msg_id = 1;
|
||||
|
||||
int mqtt_beat(void)
|
||||
{
|
||||
uint8_t head = MQTT_PINGREQ;
|
||||
uint8_t vhead[5];
|
||||
uint8_t payload[5];
|
||||
uint32_t i = 0, j = 0;
|
||||
mqtt_send(head, i, vhead, j, payload);
|
||||
if (mqtt_ack_check(MQTT_PINGRESP, 100, 0) != 0) {
|
||||
if (mqtt_connect(User_Username, User_Password, User_Client_ID) != 0) {
|
||||
return -1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mqtt_handle(void)
|
||||
{
|
||||
uint8_t recv_head;
|
||||
uint8_t recv_buff[RX_BUF_MAX_LEN];
|
||||
uint16_t recv_len;
|
||||
|
||||
if (mqtt_recv(recv_buff, &recv_len, 0) != 0) {
|
||||
return -1;
|
||||
}
|
||||
recv_head = recv_buff[0];
|
||||
|
||||
switch (recv_head & 0xF0) {
|
||||
case MQTT_PUBLISH:
|
||||
return mqtt_publish_from_cloud(recv_buff, recv_len);
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int mqtt_publish_update(uint8_t *msg, uint16_t msg_len)
|
||||
{
|
||||
if (mqtt_publish(User_MQTTServer_Topic_PUB, msg, msg_len, msg_id++) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mqtt_init(void)
|
||||
{
|
||||
if (mqtt_connect(User_Username, User_Password, User_Client_ID) != 0) {
|
||||
printf("MQTT handshake error\r\n");
|
||||
return -1;
|
||||
printf("send data to mqtt server success\r\n");
|
||||
}else
|
||||
{
|
||||
printf("MQTT handshake success\r\n");
|
||||
printf("send data to mqtt server error\r\n");
|
||||
printf(": %s\r\n", str);
|
||||
}
|
||||
|
||||
if (mqtt_subscriber(User_MQTTServer_Topic_SUB, msg_id++) != 0) {
|
||||
printf("subscribe error\r\n");
|
||||
return -1;
|
||||
}else
|
||||
{
|
||||
printf("subscribe success\r\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,57 +1,26 @@
|
||||
#ifndef __MQTT_H__
|
||||
#define __MQTT_H __
|
||||
#ifndef __MQTT_H
|
||||
#define __MQTT_H
|
||||
|
||||
#include "main.h"
|
||||
#include "esp8266.h"
|
||||
|
||||
#define User_Client_ID "50fccfefb50a48b98a93ce27bb04592f" //MQTTclientID <20><><EFBFBD>ڱ<EFBFBD>־client<6E><74><EFBFBD><EFBFBD> <20>256<35>ֽ<EFBFBD>
|
||||
#define User_Username "admin" //<2F><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> username, <20> 64 <20>ֽ<EFBFBD>
|
||||
#define User_Password "admin123" //<2F><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> password, <20> 64 <20>ֽ<EFBFBD>
|
||||
#define User_MQTTServer_IP "106.12.9.213" //MQTT<54><54><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>IP
|
||||
#define User_MQTTServer_PORT 1883 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF>
|
||||
#define User_MQTTServer_Topic_PUB "status" //<2F><><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD>
|
||||
#define User_MQTTServer_Topic_SUB "status/set/E8DB84933088" //<2F><><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD>
|
||||
/*
|
||||
*<2A><><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<DEB8><C4B2>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD>ù<EFBFBD>
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
MQTT_NULL = 0,
|
||||
MQTT_CONNECT = 1 << 4,
|
||||
MQTT_CONNACK = 2 << 4,
|
||||
MQTT_PUBLISH = 3 << 4,
|
||||
MQTT_PUBACK = 4 << 4,
|
||||
MQTT_PUBREC = 5 << 4,
|
||||
MQTT_PUBREL = 6 << 4,
|
||||
MQTT_PUBCOMP = 7 << 4,
|
||||
MQTT_SUBSCRIBE = 8 << 4,
|
||||
MQTT_SUBACK = 9 << 4,
|
||||
MQTT_UNSUBSCRIBE= 10 << 4,
|
||||
MQTT_UNSUBACK = 11 << 4,
|
||||
MQTT_PINGREQ = 12 << 4,
|
||||
MQTT_PINGRESP = 13 << 4,
|
||||
MQTT_DISCONNECT = 14 << 4,
|
||||
}MQTT_HEAD_T;
|
||||
|
||||
typedef enum{
|
||||
CONNECT_FLAG = 0,
|
||||
CONNECT_FLAG_NAME = 1 << 7,
|
||||
CONNECT_FLAG_PWD = 1 << 6,
|
||||
CONNECT_FLAG_RETAIN = 1 << 5,
|
||||
CONNECT_FLAG_QOS = 1 << 4,
|
||||
CONNECT_FLAG_FLAG = 1 << 2,
|
||||
CONNECT_FLAG_CLS = 1 << 1,
|
||||
}CONNECT_T;
|
||||
#define WIFI_SSID "DianJing" //wifi<66><69>
|
||||
#define WIFI_PWD "wzry6666" //wifi<66><69><EFBFBD><EFBFBD>
|
||||
|
||||
typedef enum{
|
||||
PUBLISH_FLAG_RETN = 1,
|
||||
PUBLISH_FLAG_QOS0 = 0,
|
||||
PUBLISH_FLAG_QOS1 = 1 << 1,
|
||||
PUBLISH_FLAG_QOS2 = 1 << 2,
|
||||
PUBLISH_FLAG_DUP = 1 << 3,
|
||||
}PUBLISH_FLAG_T;
|
||||
#define WIFI_client_id "50fccfefb50a48b98a93ce27bb04591f" //MQTTclientID <20><><EFBFBD>ڱ<EFBFBD>־client<6E><74><EFBFBD><EFBFBD> <20>256<35>ֽ<EFBFBD>
|
||||
#define WIFI_username "admin" //<2F><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> username, <20> 64 <20>ֽ<EFBFBD>
|
||||
#define WIFI_password "admin13" //<2F><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> password, <20> 64 <20>ֽ<EFBFBD>
|
||||
#define WIFI_MQTTServer_IP "106.12.9.213" //MQTT<54><54><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>IP
|
||||
#define WIFI_MQTTServer_PORT 1883 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF>
|
||||
#define WIFI_MQTTServer_Topic_PUB "status" //<2F><><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD>
|
||||
#define WIFI_MQTTServer_Topic_SUB "status/set/863488052352477" //<2F><><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD>
|
||||
|
||||
int mqtt_init(void);
|
||||
int mqtt_handle(void);
|
||||
int mqtt_beat(void);
|
||||
int mqtt_publish_update(uint8_t *msg, uint16_t msg_len);
|
||||
|
||||
#endif /* __MQTT_H */
|
||||
void ESP8266_STA_MQTTClient_Init(void);
|
||||
|
||||
#endif
|
||||
|
||||
42
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/tcp.c
Normal file
42
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/tcp.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "tcp.h"
|
||||
|
||||
volatile uint8_t TcpClosedFlag = 0;
|
||||
|
||||
void ESP8266_STA_TCPClient_Test(void)
|
||||
{
|
||||
uint8_t res;
|
||||
|
||||
char str[100]={0};
|
||||
ESP8266_ATE0();
|
||||
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ESP8266\r\n");
|
||||
ESP8266_Net_Mode_Choose(STA);
|
||||
while(!ESP8266_JoinAP(User_ESP8266_SSID, User_ESP8266_PWD));
|
||||
ESP8266_Enable_MultipleId ( DISABLE );
|
||||
while(!ESP8266_Link_Server(enumTCP, User_ESP8266_TCPServer_IP, User_ESP8266_TCPServer_PORT, Single_ID_0));
|
||||
while(!ESP8266_UnvarnishSend());
|
||||
printf("\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
while ( 1 )
|
||||
{
|
||||
sprintf (str,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><EFBFBD>ſɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾" );//<2F><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_SendString ( ENABLE, str, 0, Single_ID_0 );
|
||||
delay_ms(1000);
|
||||
if(TcpClosedFlag) //<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ʧȥ<CAA7><C8A5><EFBFBD><EFBFBD>
|
||||
{
|
||||
ESP8266_ExitUnvarnishSend(); //<2F>˳<EFBFBD><EFBFBD><CDB8>ģʽ
|
||||
do
|
||||
{
|
||||
res = ESP8266_Get_LinkStatus(); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>״̬
|
||||
}
|
||||
while(!res);
|
||||
|
||||
if(res == 4) //ȷ<><C8B7>ʧȥ<CAA7><C8A5><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
|
||||
|
||||
while (!ESP8266_JoinAP(User_ESP8266_SSID, User_ESP8266_PWD ) );
|
||||
while (!ESP8266_Link_Server(enumTCP, User_ESP8266_TCPServer_IP, User_ESP8266_TCPServer_PORT, Single_ID_0 ) );
|
||||
}
|
||||
while(!ESP8266_UnvarnishSend());
|
||||
}
|
||||
}
|
||||
}
|
||||
22
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/tcp.h
Normal file
22
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/tcp.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef __TCP_H
|
||||
#define __TCP_H
|
||||
|
||||
#include "main.h"
|
||||
#include "esp8266.h"
|
||||
|
||||
/*
|
||||
*<2A><><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<DEB8><C4B2>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD>ù<EFBFBD>
|
||||
*/
|
||||
|
||||
#define User_ESP8266_SSID "miot_default" //wifi<66><69>
|
||||
#define User_ESP8266_PWD "123456789x" //wifi<66><69><EFBFBD><EFBFBD>
|
||||
|
||||
#define User_ESP8266_TCPServer_IP "192.168.31.16" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP
|
||||
#define User_ESP8266_TCPServer_PORT "8888" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF>
|
||||
|
||||
|
||||
extern volatile uint8_t TcpClosedFlag; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>־
|
||||
|
||||
void ESP8266_STA_TCPClient_Test(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user