|
RBE1001Lib
|
#include <ESP32PWM.h>

Public Member Functions | |
| ESP32PWM () | |
| virtual | ~ESP32PWM () |
| void | detachPin (int pin) |
| void | attachPin (uint8_t pin, double freq, uint8_t resolution_bits=10) |
| bool | attached () |
| void | write (uint32_t duty) |
| void | writeScaled (float duty) |
| double | writeTone (double freq) |
| double | writeNote (note_t note, uint8_t octave) |
| void | adjustFrequency (double freq, float dutyScaled=-1) |
| uint32_t | read () |
| double | readFreq () |
| float | getDutyScaled () |
| int | getTimer () |
| int | getChannel () |
| int | getPin () |
Static Public Member Functions | |
| static int | timerAndIndexToChannel (int timer, int index) |
| static void | allocateTimer (int timerNumber) |
| static bool | hasPwm (int pin) |
| static int | channelsRemaining () |
Data Fields | |
| int | timerNum = -1 |
| uint32_t | myDuty = 0 |
Static Public Attributes | |
| static bool | explicateAllocationMode =false |
| static int | PWMCount = -1 |
| static int | timerCount [4] = { 0, 0, 0, 0 } |
| static ESP32PWM * | ChannelUsed [NUM_PWM] |
| static long | timerFreqSet [4] = { -1, -1, -1, -1 } |
Private Member Functions | |
| void | attach (int pin) |
| int | allocatenext (double freq) |
| bool | checkFrequencyForSideEffects (double freq) |
| void | adjustFrequencyLocal (double freq, float dutyScaled) |
| double | setup (double freq, uint8_t resolution_bits=10) |
| void | attachPin (uint8_t pin) |
| void | deallocate () |
Static Private Member Functions | |
| static double | _ledcSetupTimerFreq (uint8_t chan, double freq, uint8_t bit_num) |
| static float | mapf (float x, float in_min, float in_max, float out_min, float out_max) |
Private Attributes | |
| int | pwmChannel = 0 |
| bool | attachedState = false |
| int | pin |
| uint8_t | resolutionBits |
| double | myFreq |
Definition at line 17 of file ESP32PWM.h.
| ESP32PWM::ESP32PWM | ( | ) |
Definition at line 36 of file ESP32PWM.cpp.
References ChannelUsed, myFreq, NUM_PWM, pin, PWM_BASE_INDEX, pwmChannel, PWMCount, and resolutionBits.
Referenced by mapf().
|
virtual |
Definition at line 48 of file ESP32PWM.cpp.
References attached(), deallocate(), and pin.
Referenced by mapf().

|
staticprivate |
Definition at line 55 of file ESP32PWM.cpp.
Referenced by adjustFrequencyLocal().
| void ESP32PWM::adjustFrequency | ( | double | freq, |
| float | dutyScaled = -1 |
||
| ) |
Definition at line 180 of file ESP32PWM.cpp.
References adjustFrequencyLocal(), ChannelUsed, getDutyScaled(), getTimer(), myFreq, pwm, timerAndIndexToChannel(), timerCount, and writeScaled().
Referenced by attached(), and loop().

|
private |
Definition at line 166 of file ESP32PWM.cpp.
References _ledcSetupTimerFreq(), attached(), freq, getChannel(), getTimer(), myFreq, pin, resolutionBits, timerFreqSet, and writeScaled().
Referenced by adjustFrequency(), and writeTone().

|
private |
Definition at line 73 of file ESP32PWM.cpp.
References ChannelUsed, freq, myFreq, pwmChannel, PWMCount, timerAndIndexToChannel(), timerCount, timerFreqSet, and timerNum.
Referenced by checkFrequencyForSideEffects().

|
static |
allocateTimer
| a | timer number 0-3 indicating which timer to allocate in this library Switch to explicate allocation mode |
Definition at line 25 of file ESP32PWM.cpp.
References explicateAllocationMode, and timerCount.
Referenced by Motor::allocateTimer(), attached(), and setup().
|
private |
Definition at line 227 of file ESP32PWM.cpp.
References attachedState, and pin.
Referenced by attachPin().
|
inline |
Definition at line 56 of file ESP32PWM.h.
References adjustFrequency(), allocateTimer(), attachedState, getDutyScaled(), read(), readFreq(), timerAndIndexToChannel(), write(), writeNote(), writeScaled(), and writeTone().
Referenced by adjustFrequencyLocal(), analogWrite(), Servo::attached(), noTone(), setup(), tone(), and ~ESP32PWM().

|
private |
Definition at line 231 of file ESP32PWM.cpp.
References attach(), getChannel(), and hasPwm().
Referenced by analogWrite(), Servo::attach(), Motor::attach(), attachPin(), loop(), mapf(), Servo::setTimerWidth(), setup(), setup(), and tone().

| void ESP32PWM::attachPin | ( | uint8_t | pin, |
| double | freq, | ||
| uint8_t | resolution_bits = 10 |
||
| ) |
Definition at line 244 of file ESP32PWM.cpp.
References attachPin(), hasPwm(), and setup().

|
inlinestatic |
Definition at line 110 of file ESP32PWM.h.
References NUM_PWM, pin, PWMCount, and pwmFactory().
Referenced by loop().

|
private |
Definition at line 275 of file ESP32PWM.cpp.
References allocatenext(), ChannelUsed, freq, getTimer(), myFreq, pwm, pwmChannel, timerAndIndexToChannel(), and timerCount.
Referenced by setup().

|
private |
Definition at line 120 of file ESP32PWM.cpp.
References attachedState, ChannelUsed, getTimer(), pwmChannel, PWMCount, timerCount, timerFreqSet, and timerNum.
Referenced by detachPin(), mapf(), and ~ESP32PWM().

| void ESP32PWM::detachPin | ( | int | pin | ) |
Definition at line 250 of file ESP32PWM.cpp.
References deallocate().
Referenced by analogWrite(), Servo::detach(), loop(), mapf(), noTone(), Servo::setTimerWidth(), and Motor::~Motor().

| int ESP32PWM::getChannel | ( | ) |
Definition at line 136 of file ESP32PWM.cpp.
References pwmChannel.
Referenced by adjustFrequencyLocal(), attachPin(), read(), setup(), and write().
| float ESP32PWM::getDutyScaled | ( | ) |
Definition at line 155 of file ESP32PWM.cpp.
References mapf(), myDuty, and resolutionBits.
Referenced by adjustFrequency(), attached(), and writeTone().

|
inline |
|
inline |
Definition at line 84 of file ESP32PWM.h.
References timerNum.
Referenced by adjustFrequency(), adjustFrequencyLocal(), checkFrequencyForSideEffects(), deallocate(), and writeTone().
|
inlinestatic |
Definition at line 99 of file ESP32PWM.h.
Referenced by Servo::attach(), attachPin(), and loop().
|
inlinestaticprivate |
Definition at line 34 of file ESP32PWM.h.
References attachPin(), deallocate(), detachPin(), ESP32PWM(), freq, setup(), and ~ESP32PWM().
Referenced by getDutyScaled(), and writeScaled().

| uint32_t ESP32PWM::read | ( | ) |
Definition at line 221 of file ESP32PWM.cpp.
References getChannel().
Referenced by attached().

| double ESP32PWM::readFreq | ( | ) |
|
private |
Definition at line 143 of file ESP32PWM.cpp.
References attached(), attachPin(), checkFrequencyForSideEffects(), getChannel(), pin, resolutionBits, and val.
Referenced by attachPin(), and mapf().

|
static |
Definition at line 61 of file ESP32PWM.cpp.
References NUM_PWM.
Referenced by adjustFrequency(), allocatenext(), attached(), checkFrequencyForSideEffects(), and writeTone().
| void ESP32PWM::write | ( | uint32_t | duty | ) |
Definition at line 162 of file ESP32PWM.cpp.
References getChannel(), and myDuty.
Referenced by analogWrite(), attached(), Servo::writeMicroseconds(), writeScaled(), and writeTone().

| double ESP32PWM::writeNote | ( | note_t | note, |
| uint8_t | octave | ||
| ) |
Definition at line 208 of file ESP32PWM.cpp.
References writeTone().
Referenced by attached().

| void ESP32PWM::writeScaled | ( | float | duty | ) |
Definition at line 159 of file ESP32PWM.cpp.
References mapf(), resolutionBits, and write().
Referenced by adjustFrequency(), adjustFrequencyLocal(), attached(), loop(), and Motor::setEffortLocal().

| double ESP32PWM::writeTone | ( | double | freq | ) |
Definition at line 194 of file ESP32PWM.cpp.
References adjustFrequencyLocal(), ChannelUsed, getDutyScaled(), getTimer(), myFreq, pwm, resolutionBits, timerAndIndexToChannel(), timerCount, and write().
Referenced by attached(), tone(), and writeNote().

|
private |
Definition at line 22 of file ESP32PWM.h.
Referenced by attach(), attached(), and deallocate().
|
static |
Definition at line 92 of file ESP32PWM.h.
Referenced by adjustFrequency(), allocatenext(), checkFrequencyForSideEffects(), deallocate(), ESP32PWM(), and writeTone().
|
static |
Definition at line 83 of file ESP32PWM.h.
Referenced by allocateTimer().
| uint32_t ESP32PWM::myDuty = 0 |
Definition at line 88 of file ESP32PWM.h.
Referenced by getDutyScaled(), and write().
|
private |
Definition at line 25 of file ESP32PWM.h.
Referenced by adjustFrequency(), adjustFrequencyLocal(), allocatenext(), checkFrequencyForSideEffects(), ESP32PWM(), readFreq(), and writeTone().
|
private |
Definition at line 23 of file ESP32PWM.h.
Referenced by adjustFrequencyLocal(), attach(), channelsRemaining(), ESP32PWM(), getPin(), setup(), and ~ESP32PWM().
|
private |
Definition at line 21 of file ESP32PWM.h.
Referenced by allocatenext(), checkFrequencyForSideEffects(), deallocate(), ESP32PWM(), and getChannel().
|
static |
Definition at line 90 of file ESP32PWM.h.
Referenced by allocatenext(), channelsRemaining(), deallocate(), and ESP32PWM().
|
private |
Definition at line 24 of file ESP32PWM.h.
Referenced by adjustFrequencyLocal(), ESP32PWM(), getDutyScaled(), setup(), writeScaled(), and writeTone().
|
static |
Definition at line 91 of file ESP32PWM.h.
Referenced by adjustFrequency(), allocatenext(), allocateTimer(), checkFrequencyForSideEffects(), deallocate(), and writeTone().
|
static |
Definition at line 93 of file ESP32PWM.h.
Referenced by adjustFrequencyLocal(), allocatenext(), and deallocate().
| int ESP32PWM::timerNum = -1 |
Definition at line 87 of file ESP32PWM.h.
Referenced by allocatenext(), deallocate(), and getTimer().
1.8.13