Files

78 lines
1.8 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、按键、继电器(过零见 bsp_zc)
* @author cyWu <1917507415@qq.com>
* @date 2026.09.04
* @version V1.1.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 读取按键
* @return 1=按下,0=未按下
*/
uint8_t bsp_key_is_pressed(void);
/* ═══ 继电器(PC3,高电平导通)═══ */
/**
* @brief 直接写继电器 GPIO**只准由 app_relay 在过零时刻/超时路径调用**)
* @param on 1=吸合(加热开),0=断开(加热关)
* @return 无
*/
void bsp_relay_set(uint8_t on);
/**
* @brief 读继电器 GPIO 当前电平
* @return 1=吸合,0=断开
*/
uint8_t bsp_relay_get(void);
#endif /* __BSP_HW_H__ */