- synchronize STM8 application and external flash layout updates\n- add assembly bootloader and assembly application test projects\n- add UART1 interrupt receive ring buffer\n- parse JDY-28M Mesh outer frames and source addresses\n- add CRC-16/MODBUS validation\n- implement relay control command 0x01 and response 0x81\n- support unicast and broadcast relay control frames\n- update host protocol, OTA documents, and serial tools
43 lines
1.5 KiB
C
43 lines
1.5 KiB
C
/**
|
|
* @file board.h
|
|
* @brief 蓝牙 Mesh 继电器硬件板级接口定义。
|
|
*
|
|
* 本阶段先提供稳定的硬件抽象接口,不在业务层直接操作 GPIO 寄存器。
|
|
* PA1 的有效电平已经确认:高电平吸合、低电平断开;PB4 为低电平点亮的
|
|
* 蓝牙组网/故障指示灯,PB5 为低电平点亮的程序运行/OTA状态灯,PD3 为
|
|
* 高电平点亮的继电器状态灯。
|
|
*/
|
|
#ifndef BOARD_H
|
|
#define BOARD_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/** 初始化 GPIO、时钟和板级默认安全状态。 */
|
|
void Board_Init(void);
|
|
|
|
/** 设置继电器目标输出状态,1 表示吸合,0 表示断开。 */
|
|
void Board_SetRelay(uint8_t on);
|
|
|
|
/** 读取当前继电器控制输出状态,1 表示吸合,0 表示断开。 */
|
|
uint8_t Board_GetRelay(void);
|
|
|
|
/** 读取 JDY-28M STAT 状态,1 表示模块报告已组网。 */
|
|
uint8_t Board_ReadMeshJoined(void);
|
|
|
|
/** 设置蓝牙组网/故障指示灯,1表示点亮,0表示熄灭;硬件低电平点亮。 */
|
|
void Board_SetLed3(uint8_t on);
|
|
|
|
/** 设置继电器状态灯,1表示点亮,0表示熄灭;硬件高电平点亮。 */
|
|
void Board_SetRelayLed(uint8_t on);
|
|
|
|
/** 周期驱动PB5程序状态灯;硬件低电平点亮,正常运行500ms翻转,OTA期间100ms翻转。 */
|
|
void Board_StatusLedTask(uint8_t ota_active);
|
|
|
|
/** 设置 PWRC:1 表示拉低进入 AT 窗口,0 表示恢复高电平通信。 */
|
|
void Board_SetBluetoothAtWindow(uint8_t enabled);
|
|
|
|
/** 设置 RESET:1 表示拉低复位,0 表示释放复位。 */
|
|
void Board_SetBluetoothReset(uint8_t reset_active);
|
|
|
|
#endif
|