12#include "config/macros.h"
78 static uint8_t currentTickCount;
112 static uint8_t fanSpeedPercent = 0;
116 fanSpeedPercent += 2;
124 fanSpeedPercent -= 2;
126 if(fanSpeedPercent <= 10){
127 fanSpeedPercent = 10;
253 return ( raw * 0.02 );
static uint8_t Convert_From_Raw(uint16_t raw)
enum FAN_SETTINGS_e FAN_SETTINGS_t
static FAN_SETTINGS_t changeSpeed
FAN_DATA_t * devFanDataPtr
#define MIN_TICK
fastest possible tick. needed for override flag.
#define STEP_SIZE
in percent. needed for overide flag.
#define MAX_SPEED_PERCENT
macros defining the speed limits
#define INIT_SPEED_PERCENT
intial start fan value
#define MULTIPLIER
These have to be renamed to make the fan device driver abstract.
Contains temperature initialization and execution functions.
#define L_TEMPERATURE_THRESHOLD
#define H_TEMPERATURE_THRESHOLD
static void Override_Speed(void)
Override the fan speed with maximum speed.
void Dev_Fan_Task_100ms(void)
this function needs to be called every 100ms it contains the code to update the status of the fan
static uint16_t Convert_From_Percentage(uint8_t percentage)
Converts the percentage value to number of ticks.
FAN_DATA_t devFanData
Data Object of fan.
void Dev_Fan_Set_Speed(uint8_t target_speed_percent)
Sets the fan speed.
static void Calculate_Speed(void)
Calculates the fan speed.
void Dev_Fan_Set_Override(void)
Sets the fan override bit and the fan speed.
void Dev_Fan_Initialize(void)
This function initializes the fan object.
static void Update_Speed(void)
Update the fan speed.
void Dev_Fan_Task_1s(void)
This function needs to be called every 1s to keep the temperature of the board at a certain temperatu...
int8_t Dev_Temp_Get_Temperature_Celcius(void)
This converts the raw values to temperature celcius as per device lookup table.
#define FAN_PWM_DutyCycleSet
This macro defines the Custom Name for SCCP3_PWM_DutyCycleSet API.
A custom data type for fan.
uint16_t MaxSpeedRaw
based on period value (CCXPRL).
uint16_t Tick
set the execution rate in multiples of 100ms
uint8_t OverrideFlag
override flag. sets tick value to 1, step_size to 20 and target to 100%
uint16_t StepSizePercent
set the increment rate per tick in percentage
uint16_t CurrentSpeedRaw
current value raw.
uint16_t TargetSpeedRaw
targetted value raw.
uint8_t TargetSpeedPercent
targetted Speed in percentage
uint16_t MaxSpeedPercent
based on period value (CCXPRL). Use this to limit the fan max speed
uint8_t CurrentSpeedPercent
Current Speed in percentage.