shuichan_old/V1.2/STM32F103_App1/Inc/main.h

82 lines
2.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
#include "stm32f1xx_hal.h"
/* USER CODE BEGIN Includes */
#include "air780e.h"
#include "log.h"
/* USER CODE END Includes */
void Error_Handler(void);
/* USER CODE BEGIN Private defines */
#define Rx_Max 8192 /* USART3 DMA 接收缓冲OTA 分块 3KB + 头部/尾部突发约 3.1KB,留足余量 */
extern uint16_t Rx_Len;
extern uint8_t Rx_Buf[Rx_Max];
extern UART_HandleTypeDef huart3;
/* EEPROM配置魔数: 自动检测EEPROM是否已初始化 */
#define EEPROM_MAGIC 0xDEADBEEF// 0xDE123456//0xDEADBEEF
/*===== 产品型号配置 =====
* 同一套板子适配两种产品,编译前在这里二选一:
* 1 = 智能水产投料机:接 RS485 磅秤feeding 指令按 onceWt 定量自动投喂,
* 带重量反增/超时保护sw1 指令被忽略(投喂只能走 feeding
* 0 = 基础四路继电器不接磅秤feeding/sw1 指令直接开关投喂继电器 1
* 由平台侧自行计时控制
*/
#define PRODUCT_WITH_FEED_SCALE 0
/*===== MQTT 默认配置 =====*/
////锦鲤塘增氧投料机-02
//#define MQTT_CLIENT_ID "3eb3d1e51846f296"
//#define MQTT_USERNAME "766990788193702677"
//#define MQTT_PASSWORD "a0207984565267a5"
#define MQTT_CLIENT_ID "4fbaf68ca378b72b"
#define MQTT_USERNAME "698227263545354343"
#define MQTT_PASSWORD "b612c2839c135934"
#define MQTT_SERVER_IP "58.17.14.95"
#define MQTT_SERVER_PORT 1880
#define MQTT_TOPIC "/iot/data/down/"
/* MQTT配置结构体 (存储在AT24C02 EEPROM中) */
typedef struct {
char ClientID[20];
char Username[20];
char Passward[20];
char ServerIP[20];
char Topic[20];
uint16_t ServerPort;
uint8_t Relay_State[7]; /* [1..4]继电器状态, [0]保留 */
uint32_t Magic; /* 魔数, 检测EEPROM是否已初始化 */
uint16_t Ver; /* OTA固件版本号, 断电保持 */
} MqttInfo_Str;
#define MQTT_STRUCT_LEN sizeof(MqttInfo_Str)
/*===== W25Q64 外部 Flash 引脚(软件 SPI =====*/
#define W25Q64_CS_PIN GPIO_PIN_4
#define W25Q64_CS_PORT GPIOB
#define W25Q64_CLK_PIN GPIO_PIN_3
#define W25Q64_CLK_PORT GPIOB
#define W25Q64_DO_PIN GPIO_PIN_5 /* Flash DO -> MCU 输入 */
#define W25Q64_DO_PORT GPIOB
#define W25Q64_DI_PIN GPIO_PIN_15 /* MCU DI -> Flash 输入 */
#define W25Q64_DI_PORT GPIOA
extern MqttInfo_Str MqttInfoStr;
/* USER CODE END Private defines */
#ifdef __cplusplus
}
#endif
#endif /* __MAIN_H */