Skip to content

Commit fb4eb52

Browse files
authored
Merge pull request #760 from jgartrel/master
Add helper functions to HwPWM Instance
2 parents 357fa90 + 27b0c34 commit fb4eb52

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cores/nRF5/HardwarePWM.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ bool HardwarePWM::removePin(uint8_t pin)
205205
return true;
206206
}
207207

208+
bool HardwarePWM::removeAllPins(void)
209+
{
210+
for(int ch=0; ch<MAX_CHANNELS; ch++)
211+
{
212+
_set_psel(ch, 0xFFFFFFFFUL);
213+
}
214+
return true;
215+
}
216+
208217
bool HardwarePWM::writeChannel(uint8_t ch, uint16_t value, bool inverted)
209218
{
210219
VERIFY( ch < MAX_CHANNELS );

cores/nRF5/HardwarePWM.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class HardwarePWM
8888
// Remove a pin from PWM module
8989
bool removePin (uint8_t pin);
9090

91+
// Remove all pins from PWM module
92+
bool removeAllPins (void);
93+
9194
// Get the mapped channel of a pin
9295
int pin2channel(uint8_t pin) const
9396
{

0 commit comments

Comments
 (0)