|
@@ -245,14 +245,15 @@ bool LPC1768_PWM_detach_pin(pin_t pin) {
|
245
|
245
|
|
246
|
246
|
pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF));
|
247
|
247
|
|
248
|
|
- NVIC_EnableIRQ(PWM1_IRQn); // ?? fixes compiler problem?? ISR won't start
|
249
|
|
- // unless put in an extra "enable"
|
250
|
248
|
NVIC_DisableIRQ(PWM1_IRQn);
|
251
|
249
|
|
252
|
250
|
uint8_t slot = 0xFF;
|
253
|
251
|
for (uint8_t i = 0; i < NUM_PWMS; i++) // find slot
|
254
|
252
|
if (ISR_table[i].pin == pin) { slot = i; break; }
|
255
|
|
- if (slot == 0xFF) return false; // return error if pin not found
|
|
253
|
+ if (slot == 0xFF) { // return error if pin not found
|
|
254
|
+ NVIC_EnableIRQ(PWM1_IRQn);
|
|
255
|
+ return false;
|
|
256
|
+ }
|
256
|
257
|
|
257
|
258
|
LPC1768_PWM_update_map_MR();
|
258
|
259
|
|
|
@@ -315,7 +316,10 @@ bool LPC1768_PWM_write(pin_t pin, uint32_t value) {
|
315
|
316
|
uint8_t slot = 0xFF;
|
316
|
317
|
for (uint8_t i = 0; i < NUM_PWMS; i++) // find slot
|
317
|
318
|
if (ISR_table[i].pin == pin) { slot = i; break; }
|
318
|
|
- if (slot == 0xFF) return false; // return error if pin not found
|
|
319
|
+ if (slot == 0xFF) { // return error if pin not found
|
|
320
|
+ NVIC_EnableIRQ(PWM1_IRQn);
|
|
321
|
+ return false;
|
|
322
|
+ }
|
319
|
323
|
|
320
|
324
|
LPC1768_PWM_update_map_MR();
|
321
|
325
|
|