From a74270d072e056a7c68a5445ba00e1e4b78ec151 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Fri, 29 Nov 2019 14:55:46 -0500 Subject: [PATCH 1/2] Cordio: add missing timer.start() in BLE thread loop --- src/utility/HCICordioTransport.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utility/HCICordioTransport.cpp b/src/utility/HCICordioTransport.cpp index 1b02e36c..4ef04ba9 100644 --- a/src/utility/HCICordioTransport.cpp +++ b/src/utility/HCICordioTransport.cpp @@ -111,6 +111,8 @@ static void bleLoop() uint64_t last_update_us = 0; mbed::LowPowerTimer timer; + timer.start(); + while (true) { last_update_us += (uint64_t) timer.read_high_resolution_us(); timer.reset(); From ee90592bfe27d370f255f9171411836174cf06c2 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Fri, 29 Nov 2019 14:59:52 -0500 Subject: [PATCH 2/2] Cordio: switch back to using WSF_MS_PER_TICK in BLE thread loop --- src/utility/HCICordioTransport.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/utility/HCICordioTransport.cpp b/src/utility/HCICordioTransport.cpp index 4ef04ba9..f2a83d97 100644 --- a/src/utility/HCICordioTransport.cpp +++ b/src/utility/HCICordioTransport.cpp @@ -103,8 +103,6 @@ extern "C" void wsf_mbed_ble_signal_event(void) } #endif //CORDIO_ZERO_COPY_HCI -#define CORDIO_TRANSPORT_WSF_MS_PER_TICK 10 - static void bleLoop() { #if CORDIO_ZERO_COPY_HCI @@ -118,7 +116,7 @@ static void bleLoop() timer.reset(); uint64_t last_update_ms = (last_update_us / 1000); - wsfTimerTicks_t wsf_ticks = (last_update_ms / CORDIO_TRANSPORT_WSF_MS_PER_TICK); + wsfTimerTicks_t wsf_ticks = (last_update_ms / WSF_MS_PER_TICK); if (wsf_ticks > 0) { WsfTimerUpdate(wsf_ticks); @@ -139,9 +137,9 @@ static void bleLoop() uint64_t time_spent = (uint64_t) timer.read_high_resolution_us(); /* don't bother sleeping if we're already past tick */ - if (sleep && (CORDIO_TRANSPORT_WSF_MS_PER_TICK * 1000 > time_spent)) { + if (sleep && (WSF_MS_PER_TICK * 1000 > time_spent)) { /* sleep to maintain constant tick rate */ - uint64_t wait_time_us = CORDIO_TRANSPORT_WSF_MS_PER_TICK * 1000 - time_spent; + uint64_t wait_time_us = WSF_MS_PER_TICK * 1000 - time_spent; uint64_t wait_time_ms = wait_time_us / 1000; wait_time_us = wait_time_us % 1000; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy