64 lines
1.7 KiB
C
64 lines
1.7 KiB
C
#ifndef __MAIN_H
|
||
#define __MAIN_H
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/* 头文件 ------------------------------------------------------------------*/
|
||
#include "stm32f1xx_hal.h"
|
||
#include <stdio.h>
|
||
#include <stdarg.h>
|
||
#include <string.h>
|
||
#include <stdint.h>
|
||
#include <stdbool.h>
|
||
|
||
#include "led.h"
|
||
#include "relay.h"
|
||
#include "systeminit.h"
|
||
#include "usart.h"
|
||
#include "cat.h"
|
||
#include "log.h"
|
||
#include "iic.h"
|
||
#include "spi.h"
|
||
#include "w25qxx.h"
|
||
#include "24c02.h"
|
||
#include "ota.h"
|
||
|
||
|
||
#define Download 0 //烧录标志 = 1 将现成MQTT数据写入eeprom = 0 读取eeprom内的数据
|
||
|
||
#define GPIOA_RCC_ENABLE __HAL_RCC_GPIOA_CLK_ENABLE() //使能端口A时钟
|
||
#define GPIOB_RCC_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE() //使能端口B时钟
|
||
#define GPIOC_RCC_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE() //使能端口C时钟
|
||
#define GPIOD_RCC_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE() //使能端口C时钟
|
||
|
||
|
||
|
||
typedef struct{
|
||
char ClientID[20]; //存放客户端ID的缓冲区
|
||
char Username[20]; //存放用户名的缓冲区
|
||
char Passward[20]; //存放密码的缓冲区
|
||
char ServerIP[20]; //存放服务器IP或是域名缓冲区
|
||
char Topic[20]; //存放订阅主题
|
||
uint16_t ServerPort; //存放服务器端口号
|
||
uint8_t Relay_State[8]; //继电器状态 为方便理解 0和7 8 暂不使用
|
||
uint16_t iapVer;//版本号
|
||
uint16_t iapFlag;//ota标志位 1:升级 0:不升级
|
||
char iapid[16];//更新程序指令id存储
|
||
uint16_t iapCount;//记录升级次数
|
||
}MqttInfo_Str;
|
||
|
||
#define MQTT_STRUCT_LEN sizeof(MqttInfo_Str)
|
||
|
||
extern MqttInfo_Str MqttInfoStr;
|
||
|
||
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif /* __MAIN_H */
|
||
|