Browse Source

update:pmu_timer使用后关闭

Dozingfiretruck 2 years ago
parent
commit
1e2e462e61
1 changed files with 10 additions and 0 deletions
  1. 10 0
      app/port/luat_pm_air101.c

+ 10 - 0
app/port/luat_pm_air101.c

@@ -24,16 +24,26 @@ int luat_pm_request(int mode) {
     return -1;
 }
 
+static void pmu_timer0_irq(uint8_t *arg){
+    tls_pmu_timer0_stop();
+}
+
+static void pmu_timer1_irq(uint8_t *arg){
+    tls_pmu_timer1_stop();
+}
+
 //int luat_pm_release(int mode);
 int luat_pm_dtimer_start(int id, size_t timeout) {
     tls_pmu_clk_select(1);
     if (id == 0 && timeout > 0) {
         // 单位秒
+        tls_pmu_timer0_isr_register((tls_pmu_irq_callback)pmu_timer0_irq, NULL);
         tls_pmu_timer0_start((timeout + 999) / 1000);
         return 0;
     }
     else if (id == 1 && timeout > 0) {
         // 单位毫妙
+        tls_pmu_timer1_isr_register((tls_pmu_irq_callback)pmu_timer1_irq, NULL);
         tls_pmu_timer1_start(timeout);
         return 0;
     }