43 lines
1.3 KiB
C
43 lines
1.3 KiB
C
|
|
#ifndef IO_FLASH_H
|
|||
|
|
#define IO_FLASH_H
|
|||
|
|
|
|||
|
|
#include <Arduino.h>
|
|||
|
|
#include <Preferences.h>
|
|||
|
|
|
|||
|
|
// 引脚定义
|
|||
|
|
#define BOOT_BUTTON_PIN 0 // Boot按钮引脚
|
|||
|
|
#define NETWORK_LED_PIN 35 // 网络状态LED指示灯开发板48引脚,雷达板35引脚
|
|||
|
|
#define CONFIG_CLEAR_PIN 4 // 配置清除指示灯
|
|||
|
|
#define Radar_Start 36 // 定义雷达启动引脚拉高启动
|
|||
|
|
#define GPIO8 8 // 自定义GPIO8
|
|||
|
|
#define GPIO9 9 // 自定义GPIO9
|
|||
|
|
|
|||
|
|
// 配置清除指示灯状态枚举
|
|||
|
|
enum ConfigClearStatus {
|
|||
|
|
CONFIG_NORMAL, // 正常运行 - LOW
|
|||
|
|
CONFIG_PREPARING, // 准备清除 - HIGH
|
|||
|
|
CONFIG_CLEARING, // 清除过程中 - 呼吸灯
|
|||
|
|
CONFIG_COMPLETED // 清除完成 - 快速闪烁3次
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 全局变量声明
|
|||
|
|
extern Preferences preferences;
|
|||
|
|
extern uint16_t currentDeviceId; // 当前设备ID
|
|||
|
|
extern bool clearConfigRequested; // 清除配置请求标志
|
|||
|
|
extern bool forceLedOff; // 强制关闭LED标志
|
|||
|
|
extern ConfigClearStatus currentConfigClearStatus; // 当前配置清除状态
|
|||
|
|
|
|||
|
|
// 函数声明
|
|||
|
|
void checkBootButton();
|
|||
|
|
void loadDeviceId();
|
|||
|
|
void saveDeviceId();
|
|||
|
|
void clearStoredConfig();
|
|||
|
|
void io_flash_init();
|
|||
|
|
|
|||
|
|
// 任务声明
|
|||
|
|
void configClearLedTask(void *parameter);
|
|||
|
|
void bootButtonMonitorTask(void *parameter);
|
|||
|
|
void ledControlTask(void *parameter);
|
|||
|
|
|
|||
|
|
#endif // IO_FLASH_H
|