Corsair Lighting Protocol
0.15.0
Control LEDs connected to an Arduino with iCUE
|
#include <SimpleFanController.h>
Public Member Functions | |
SimpleFanController (TemperatureController *temperatureController, uint16_t updateRate, uint16_t eEPROMAdress) | |
void | addFan (uint8_t index, PWMFan *fan) |
virtual bool | updateFans () |
Public Member Functions inherited from FanController | |
virtual void | handleFanControl (const Command &command, const CorsairLightingProtocolResponse *response) override |
Protected Member Functions | |
virtual uint16_t | getFanSpeed (uint8_t fan) override |
virtual void | setFanSpeed (uint8_t fan, uint16_t speed) override |
virtual uint8_t | getFanPower (uint8_t fan) override |
virtual void | setFanPower (uint8_t fan, uint8_t percentage) override |
virtual void | setFanCurve (uint8_t fan, uint8_t group, FanCurve &fanCurve) override |
virtual void | setFanExternalTemperature (uint8_t fan, uint16_t temp) override |
virtual void | setFanForce3PinMode (bool flag) override |
virtual FanDetectionType | getFanDetectionType (uint8_t fan) override |
virtual void | setFanDetectionType (uint8_t fan, FanDetectionType type) override |
bool | load () |
bool | save () |
Protected Attributes | |
TemperatureController *const | temperatureController |
PWMFan * | fans [FAN_NUM] = {nullptr} |
bool | force3PinMode = false |
FanData | fanData [FAN_NUM] |
uint16_t | externalTemp [FAN_NUM] |
uint16_t | updateRate |
uint16_t | eEPROMAdress |
bool | triggerSave = false |
unsigned long | lastUpdate = 0 |
This simple Fan Controller implementation does not implement all features of a Fan Controller. It should only demonstrate how to implement your own Fan Controller.
SimpleFanController::SimpleFanController | ( | TemperatureController * | temperatureController, |
uint16_t | updateRate, | ||
uint16_t | eEPROMAdress | ||
) |
Fan Controller must use the EEPROM else on startup the fans can't be controlled
temperatureController | the TemperatureController used to get the temperature to control the fans |
updateRate | is the time between fan speed updates in ms |
eEPROMAdress | the address where the data is stored in EEPROM |
void SimpleFanController::addFan | ( | uint8_t | index, |
PWMFan * | fan | ||
) |
Add a fan to the Controller.
index | the index of the fan |
fan | the fan object |
|
overrideprotectedvirtual |
Get the fan DetectionType for a fan.
fan | index of the fan |
Implements FanController.
|
overrideprotectedvirtual |
Get the power percentage of a fan.
fan | index of the fan |
Implements FanController.
|
overrideprotectedvirtual |
Get the fan speed.
fan | index of the fan |
Implements FanController.
|
overrideprotectedvirtual |
Set a FanCure for a fan.
fan | index of the fan |
group | the temperature group used for getting the temperature for this fan |
fanCurve | the fan curve data |
Implements FanController.
|
overrideprotectedvirtual |
Set the fan DetectionType for a fan.
fan | index of the fan |
type | the FanDetectionType |
Implements FanController.
|
overrideprotectedvirtual |
Set the external temperature for a fan. The external temperature is provied by the iCUE.
fan | index of the fan |
temp | The temperature in hundredths of a degree Celsius. |
Implements FanController.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
fan | index of the fan |
percentage | 255 mean 100%. |
Implements FanController.
|
overrideprotectedvirtual |
Set the fan speed to a fixed value.
fan | index of the fan |
speed | fan speed in RPM. |
Implements FanController.
|
virtual |
Update the fan speeds based on the temperature and commands.
|
protected |
Indicates that the configuration of the fans has been changed and should be saved.