You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2020/11/17 16:08:21 UTC

[mynewt-core] 02/02: hw/mcu/cmac: Perform RF calibration while idle

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 81c25f77a5b87910a81acf3162f16d07bb04341c
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 16 22:36:20 2020 +0100

    hw/mcu/cmac: Perform RF calibration while idle
    
    If we are idle, we can try to perform RF recalibration. If
    recalibration was executed, we skip sleep execution in current
    iteration and will reevaluate sleep on next entry.
---
 hw/mcu/dialog/cmac/src/cmac_sleep.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/mcu/dialog/cmac/src/cmac_sleep.c b/hw/mcu/dialog/cmac/src/cmac_sleep.c
index 5a97099..bd0bc88 100644
--- a/hw/mcu/dialog/cmac/src/cmac_sleep.c
+++ b/hw/mcu/dialog/cmac/src/cmac_sleep.c
@@ -205,6 +205,8 @@ cmac_sleep_recalculate(void)
     }
 }
 
+extern bool ble_rf_try_recalibrate(uint32_t idle_time_us);
+
 void
 cmac_sleep(void)
 {
@@ -236,6 +238,10 @@ cmac_sleep(void)
         goto do_sleep;
     }
 
+    if (ble_rf_try_recalibrate(sleep_usecs)) {
+        goto skip_sleep;
+    }
+
     sleep_lp_ticks = cmac_timer_usecs_to_lp_ticks(sleep_usecs);
     if (sleep_lp_ticks <= 1) {
         switch_to_slp = false;
@@ -305,5 +311,6 @@ do_sleep:
         g_mcu_wait_for_swd_start = cmac_timer_read_hi();
     }
 
+skip_sleep:
     MCU_DIAG_SER('>');
 }