-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
|
||
#pragma once | ||
|
||
#include "hal/ledc_types.h" | ||
|
||
class Fan | ||
{ | ||
public: | ||
static void init(); | ||
/** | ||
* Set the speed (duty cycle) between 0 - 100 | ||
* Initializes the fan controller to default values: | ||
* - GPIO: 16 | ||
* - CLK: 10 kHz | ||
* - Duty: 0 | ||
*/ | ||
void init(int gpioNum = 16, uint32_t freqHz = 10000, uint32_t duty = 0); | ||
|
||
/** | ||
* Go intensity between 0 - 46665 (61 pixels) | ||
*/ | ||
void setGoIntensity(unsigned int goIntensity); | ||
|
||
/** | ||
* Stop intensity between 0 - 45900 (60 pixels) | ||
*/ | ||
void setStopIntensity(unsigned int stopIntensity); | ||
|
||
private: | ||
unsigned int m_accumGo; | ||
unsigned int m_accumStop; | ||
|
||
/** | ||
* Sets the speed based on sign intensities (duty: 0-100) | ||
*/ | ||
static void setSpeed(unsigned int val); | ||
}; | ||
void setSpeed(); | ||
}; | ||
|
||
extern Fan fanControl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters