喷淋器 P0 功能实现

This commit is contained in:
2026-09-09 15:03:50 +08:00
parent b880b2e62b
commit 866b522c59
30 changed files with 3773 additions and 25 deletions
+79
View File
@@ -0,0 +1,79 @@
/******************************************************************************
* @file bsp_hw.h
* @brief 板级 GPIO:红绿 LED、双键、水泵双脚(低层原语)
* @author cyWu <1917507415@qq.com>
* @date 2026.09.09
* @version V1.0.0
******************************************************************************/
#ifndef __BSP_HW_H__
#define __BSP_HW_H__
#include <stdint.h>
#include "board_pin.h"
typedef enum {
BSP_HW_OK = 0,
BSP_HW_ERR_NOT_INIT
} BspHw_Ret_t;
/**
* @brief 初始化 GPIO:LED 双通道(初始灭)、双键(上拉输入)、泵两脚(初始低)
* @return BSP_HW_OK=成功
*/
BspHw_Ret_t bsp_hw_init(void);
/**
* @brief 查询板级硬件是否已初始化
* @return BSP_HW_OK=已初始化,BSP_HW_ERR_NOT_INIT=未初始化
*/
BspHw_Ret_t bsp_hw_get_status(void);
/* ═══ 红绿 LED(低电平亮;on 传"亮"语义,内部按 BOARD_LED_ON_LEVEL 取反)═══ */
/**
* @brief 红灯开关(PA8,低亮)
* @param on 1=亮,0=灭
* @return 无
*/
void bsp_led_red_set(uint8_t on);
/**
* @brief 绿灯开关(PA7,低亮)
* @param on 1=亮,0=灭
* @return 无
*/
void bsp_led_green_set(uint8_t on);
/**
* @brief 红绿全灭
* @return 无
*/
void bsp_led_all_off(void);
/* ═══ 按键(低按下)═══ */
/**
* @brief 读喷淋键(PB1
* @return 1=按下,0=未按下
*/
uint8_t bsp_key_spray_is_pressed(void);
/**
* @brief 读配网键(PA0
* @return 1=按下,0=未按下
*/
uint8_t bsp_key_pair_is_pressed(void);
/* ═══ 水泵(PC2 供 5V + PA6 导通,**成对操作**)═══ */
/**
* @brief 成对切泵:on=1 时 PC2 与 PA6 同时置高;on=0 时同时拉低
* @note ⚠ 禁止只开其中一只脚。本接口是唯一能改泵 GPIO 的出口,
* 调用方只准是 app_pump(上层业务经 app_spray 间接请求)。
* @param on 1=泵转,0=泵停
* @return 无
*/
void bsp_pump_set(uint8_t on);
#endif /* __BSP_HW_H__ */