armchair_fw/main/fan.hpp
jonny_ji7 ad2dbb0ce0 Create class controlledFan, Add getStatus to motorctl
- Add class for controlling fans for cooling the motor drivers
- Add configuration for left and right fan to config.cpp
- Create fan task in main.cpp
- Add getStatus function to controlledMotor class
2022-06-11 16:47:13 +02:00

41 lines
733 B
C++

#pragma once
extern "C"
{
#include "driver/gpio.h"
}
#include "motorctl.hpp"
//struct with all config parameters for a fan
typedef struct fan_config_t {
gpio_num_t gpio_fan;
uint32_t msRun;
float dutyThreshold;
} fan_config;
//==================================
//====== controlledFan class =======
//==================================
class controlledFan {
public:
//--- constructor ---
controlledFan (fan_config_t config_f, controlledMotor* motor_f );
//--- functions ---
void handle();
private:
//--- variables ---
uint32_t timestamp_lastThreshold;
fan_config_t config;
controlledMotor * motor;
motorCommand_t motorStatus;
};