Merge pull request #760 from jgartrel/master

Add helper functions to HwPWM Instance
This commit is contained in:
Ha Thach authored and GitHub committed 2023-06-27 18:03:16 +07:00
commit fb4eb5211a
2 files changed
+12

No files matched your search

+9
View File
@@ -205,6 +205,15 @@ bool HardwarePWM::removePin(uint8_t pin)
return true;
}
bool HardwarePWM::removeAllPins(void)
{
for(int ch=0; ch<MAX_CHANNELS; ch++)
{
_set_psel(ch, 0xFFFFFFFFUL);
}
return true;
}
bool HardwarePWM::writeChannel(uint8_t ch, uint16_t value, bool inverted)
{
VERIFY( ch < MAX_CHANNELS );
+3
View File
@@ -88,6 +88,9 @@ class HardwarePWM
// Remove a pin from PWM module
bool removePin (uint8_t pin);
// Remove all pins from PWM module
bool removeAllPins (void);
// Get the mapped channel of a pin
int pin2channel(uint8_t pin) const
{