Skip to content

Commit ddd3358

Browse files
committed
revert checking for inISR before logging
1 parent 786ceae commit ddd3358

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cores/nRF5/HardwarePWM.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,14 @@ uint8_t HardwarePWM::freeChannelCount(void) const
273273
// returns true ONLY when (1) no PWM channel has a pin, and (2) the owner token is nullptr
274274
bool HardwarePWM::takeOwnership(uint32_t token)
275275
{
276+
276277
if (token == 0) {
277-
LOG_LV1("HwPWM", "zero / nullptr is not a valid ownership token (attempted use in takeOwnership)");
278+
if (!isInISR()) LOG_LV1("HwPWM", "zero is not a valid ownership token (attempted use in takeOwnership)");
278279
return false;
279280
}
280281

281282
if (token == this->_owner_token) {
282-
LOG_LV1("HwPWM", "failing to acquire ownership because already owned by requesting token (cannot take ownership twice)");
283+
if (!isInISR()) LOG_LV1("HwPWM", "failing to acquire ownership because already owned by requesting token (cannot take ownership twice)");
283284
return false;
284285
}
285286

@@ -296,22 +297,22 @@ bool HardwarePWM::takeOwnership(uint32_t token)
296297
bool HardwarePWM::releaseOwnership(uint32_t token)
297298
{
298299
if (token == 0) {
299-
LOG_LV1("HwPWM", "zero / nullptr is not a valid ownership token (attempted use in releaseOwnership)");
300+
if (!isInISR()) LOG_LV1("HwPWM", "zero is not a valid ownership token (attempted use in releaseOwnership)");
300301
return false;
301302
}
302303

303304
if (!this->isOwner(token)) {
304-
LOG_LV1("HwPWM", "attempt to release ownership when not the current owner");
305+
if (!isInISR()) LOG_LV1("HwPWM", "attempt to release ownership when not the current owner");
305306
return false;
306307
}
307308

308309
if (this->usedChannelCount() != 0) {
309-
LOG_LV1("HwPWM", "attempt to release ownership when at least on channel is still connected");
310+
if (!isInISR()) LOG_LV1("HwPWM", "attempt to release ownership when at least on channel is still connected");
310311
return false;
311312
}
312313

313314
if (this->enabled()) {
314-
LOG_LV1("HwPWM", "attempt to release ownership when PWM peripheral is still enabled");
315+
if (!isInISR()) LOG_LV1("HwPWM", "attempt to release ownership when PWM peripheral is still enabled");
315316
return false; // if it's enabled, do not allow ownership to be released, even with no pins in use
316317
}
317318

cores/nRF5/Tone.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void tone(uint8_t pin, unsigned int frequency, unsigned long duration)
177177
uint16_t time_period = _calculate_time_period(frequency);
178178
if (!_pwm_config.ensurePwmPeripheralOwnership()) {
179179
LOG_LV1("Tone", "Unable to acquire PWM peripheral");
180-
} else if (!_pwm_config.stopPlayback()) {
180+
} else if (!_pwm_config.stopPlayback(false)) {
181181
LOG_LV1("Tone", "Unable to stop playback");
182182
} else if (!_pwm_config.initializeFromPulseCountAndTimePeriod(pulse_count, time_period)) {
183183
LOG_LV1("Tone", "Failed calculating configuration");

0 commit comments

Comments
 (0)