瀏覽代碼

Merge pull request #8518 from Bob-the-Kuhn/temp-test-servo-2

[2.0.x] LP1768 - fix PWMs
Bob-the-Kuhn 7 年之前
父節點
當前提交
0c95262b9e
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 8 行新增4 行删除
  1. 8
    4
      Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp

+ 8
- 4
Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp 查看文件

@@ -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
 

Loading…
取消
儲存