We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 49568c0 + e61fbe9 commit 10a9af5Copy full SHA for 10a9af5
cores/nRF5/HardwarePWM.cpp
@@ -78,14 +78,20 @@ void HardwarePWM::setClockDiv(uint8_t div)
78
*/
79
bool HardwarePWM::addPin(uint8_t pin)
80
{
81
- VERIFY( isPinValid(pin) && (_count < MAX_CHANNELS) );
+ VERIFY( isPinValid(pin) && (_count <= MAX_CHANNELS) );
82
83
// Check if pin is already configured
84
for(uint8_t i=0; i<_count; i++)
85
86
if (_pwm->PSEL.OUT[i] == pin) return true;
87
}
88
89
+ if ((_count >= MAX_CHANNELS))
90
+ {
91
+ //Pin not already configured, but this HardwarePWM is full
92
+ return false;
93
+ }
94
+
95
pinMode(pin, OUTPUT);
96
digitalWrite(pin, LOW);
97
0 commit comments