current_v/Inc/compressor_valve_switch.h
2025-12-31 08:21:43 +08:00

106 lines
3.5 KiB
C

/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : compressor_valve_switch.h
* @brief : 压缩机、电磁阀、散热风扇控制头文件
* @version : 1.0
* @changelog : version 1.0 初始版本 2025.12.10
******************************************************************************
* @attention
*
* Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China
* THIS SOFTWARE is licensed under the Mulan PSL v1.
* can use this software according to the terms and conditions of the Mulan PSL v1.
* You may obtain a copy of Mulan PSL v1 at:
* http://license.coscl.org.cn/MulanPSL
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v1 for more details.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __COMPRESSOR_VALVE_SWITCH_H
#define __COMPRESSOR_VALVE_SWITCH_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "fm33lg0xx_fl.h"
#include "fm33lg0xx_queue.h"
#include "fm33lg0xx_event.h"
// 通过队列及事件组中内容 完成电磁阀、压缩机、风扇状态切换
// 硬件重映射
#define VALVE_1_GPIO_PORT GPIOE
#define VALVE_1_GPIO_PIN FL_GPIO_PIN_1
#define VALVE_2_GPIO_PORT GPIOE
#define VALVE_2_GPIO_PIN FL_GPIO_PIN_2
#define COMPRESSOR_GPIO_PORT GPIOD
#define COMPRESSOR_GPIO_PIN FL_GPIO_PIN_4
#define FAN_1_GPIO_PORT GPIOE
#define FAN_1_GPIO_PIN FL_GPIO_PIN_0
#define FAN_2_GPIO_PORT GPIOB
#define FAN_2_GPIO_PIN FL_GPIO_PIN_13
#define FAN_3_GPIO_PORT GPIOB
#define FAN_3_GPIO_PIN FL_GPIO_PIN_14
#define COMPRESSOR_ON FL_GPIO_SetOutputPin(COMPRESSOR_GPIO_PORT,COMPRESSOR_GPIO_PIN);
#define COMPRESSOR_OFF FL_GPIO_ResetOutputPin(COMPRESSOR_GPIO_PORT,COMPRESSOR_GPIO_PIN);
#define VALVE_1_ON FL_GPIO_SetOutputPin(VALVE_1_GPIO_PORT,VALVE_1_GPIO_PIN);
#define VALVE_1_OFF FL_GPIO_ResetOutputPin(VALVE_1_GPIO_PORT,VALVE_1_GPIO_PIN);
#define VALVE_2_ON FL_GPIO_SetOutputPin(VALVE_2_GPIO_PORT,VALVE_2_GPIO_PIN);
#define VALVE_2_OFF FL_GPIO_ResetOutputPin(VALVE_2_GPIO_PORT,VALVE_2_GPIO_PIN);
#define FAN_1_ON FL_GPIO_SetOutputPin(FAN_1_GPIO_PORT,FAN_1_GPIO_PIN);
#define FAN_1_OFF FL_GPIO_ResetOutputPin(FAN_1_GPIO_PORT,FAN_1_GPIO_PIN);
#define FAN_2_ON FL_GPIO_SetOutputPin(FAN_2_GPIO_PORT,FAN_2_GPIO_PIN);
#define FAN_2_OFF FL_GPIO_ResetOutputPin(FAN_2_GPIO_PORT,FAN_2_GPIO_PIN);
#define FAN_3_ON FL_GPIO_SetOutputPin(FAN_3_GPIO_PORT,FAN_3_GPIO_PIN);
#define FAN_3_OFF FL_GPIO_ResetOutputPin(FAN_3_GPIO_PORT,FAN_3_GPIO_PIN);
#define FAN_ALL_ON FAN_1_ON;FAN_2_ON;FAN_3_ON;
#define FAN_ALL_OFF FAN_1_OFF;FAN_2_OFF;FAN_3_OFF;
void compressor_valve_init(void); // 初始化压缩机、电磁阀、、风扇
void compressor_valve_task(void); // 压缩机、电磁阀控制任务 20ms执行一次
#ifdef __cplusplus
}
#endif
#endif /* __COMPRESSOR_VALVE_SWITCH_H */
/************************ (C) COPYRIGHT Yuwell *****END OF FILE****/