Files
wuchuyuan 0dd65e1552 1、喷淋器 P1/P2功能实现
2、红灯按连接态慢闪
2026-09-09 19:57:00 +08:00

80 lines
2.0 KiB
C
Raw Permalink 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.
/******************************************************************************
* @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 红灯开关(PA7,低亮)
* @param on 1=亮,0=灭
* @return 无
*/
void bsp_led_red_set(uint8_t on);
/**
* @brief 绿灯开关(PA8,低亮)
* @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__ */