![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Manages PWM-based fan speed control. More...
#include <FanController.h>
Public Member Functions | |
FanController (uint8_t pin) | |
Constructs a FanController with the specified pin. | |
void | Initialize () |
Initializes the fan controller by setting up the pin for PWM output. | |
void | SetPWM (uint8_t pwm) |
Sets the PWM value to control the fan speed. | |
void | SetSpeed (float ratio) |
Sets the fan speed as a ratio of its maximum speed. | |
uint8_t | GetPWM () |
Retrieves the current PWM value. | |
Private Attributes | |
uint8_t | pin |
The pin number connected to the fan's PWM input. | |
uint8_t | pwm |
The current PWM value (0-255). | |
Manages PWM-based fan speed control.
The FanController class provides functionality for initializing a fan, setting its speed using PWM signals, and retrieving the current PWM value.
Definition at line 24 of file FanController.h.
FanController | ( | uint8_t | pin | ) |
Constructs a FanController with the specified pin.
pin | The pin number connected to the fan's PWM input. |
Definition at line 3 of file FanController.cpp.
References pin.
uint8_t GetPWM | ( | ) |
Retrieves the current PWM value.
Definition at line 21 of file FanController.cpp.
References pwm.
void Initialize | ( | ) |
Initializes the fan controller by setting up the pin for PWM output.
Definition at line 7 of file FanController.cpp.
References pin.
Referenced by ProtogenProject::Initialize().
Sets the PWM value to control the fan speed.
pwm | The PWM value (0-255) to set. |
Definition at line 11 of file FanController.cpp.
Referenced by SetSpeed(), and ProtogenProject::UpdateFace().
Sets the fan speed as a ratio of its maximum speed.
Definition at line 16 of file FanController.cpp.
References Mathematics::Map(), pwm, and SetPWM().
|
private |
The pin number connected to the fan's PWM input.
Definition at line 26 of file FanController.h.
Referenced by FanController(), Initialize(), and SetPWM().
|
private |
The current PWM value (0-255).
Definition at line 27 of file FanController.h.
Referenced by GetPWM(), SetPWM(), and SetSpeed().