可用的文件,全部
This commit is contained in:
60
Core/Bsp/bsp_relay.h
Normal file
60
Core/Bsp/bsp_relay.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @file bsp_relay.h
|
||||
* @brief Relay control driver (LIGHT & FAN)
|
||||
* @details Low level effective (low level = ON)
|
||||
*/
|
||||
|
||||
#ifndef __BSP_RELAY_H
|
||||
#define __BSP_RELAY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* Exported defines ----------------------------------------------------------*/
|
||||
#define RELAY_ON GPIO_PIN_RESET // Low level activates relay
|
||||
#define RELAY_OFF GPIO_PIN_SET // High level deactivates relay
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
typedef enum {
|
||||
FAN_MODE_MANUAL = 0, // Manual control
|
||||
FAN_MODE_AUTO = 1 // Auto control by temperature
|
||||
} fan_mode_t;
|
||||
|
||||
typedef struct {
|
||||
fan_mode_t fan_mode; // FAN mode: manual or auto
|
||||
float fan_threshold; // Temperature threshold for auto mode (Celsius)
|
||||
uint8_t light_state; // LIGHT state: 0=off, 1=on
|
||||
uint8_t fan_state; // FAN state: 0=off, 1=on
|
||||
} system_state_t;
|
||||
|
||||
/* Exported functions prototypes --------------------------------------------*/
|
||||
void BSP_Relay_Init(void);
|
||||
void BSP_LIGHT_On(void);
|
||||
void BSP_LIGHT_Off(void);
|
||||
void BSP_LIGHT_Toggle(void);
|
||||
uint8_t BSP_LIGHT_GetState(void);
|
||||
|
||||
void BSP_FAN_On(void);
|
||||
void BSP_FAN_Off(void);
|
||||
void BSP_FAN_Toggle(void);
|
||||
uint8_t BSP_FAN_GetState(void);
|
||||
|
||||
/* Auto control functions (for temperature-based fan control) -------------*/
|
||||
void BSP_FAN_SetMode(fan_mode_t mode);
|
||||
fan_mode_t BSP_FAN_GetMode(void);
|
||||
void BSP_FAN_SetThreshold(float threshold);
|
||||
float BSP_FAN_GetThreshold(void);
|
||||
void BSP_FAN_AutoControl(float current_temp);
|
||||
|
||||
/* System state --------------------------------------------------------------*/
|
||||
void BSP_System_GetState(system_state_t *state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BSP_RELAY_H */
|
||||
Reference in New Issue
Block a user