Skip to content

Commit 495b941

Browse files
authored
Merge pull request #10 from cparata/master
Sync with ArduinoBLE
2 parents 4734253 + 83671f4 commit 495b941

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: src/utility/HCICordioTransport.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,20 @@ extern "C" void wsf_mbed_ble_signal_event(void)
103103
}
104104
#endif //CORDIO_ZERO_COPY_HCI
105105

106-
#define CORDIO_TRANSPORT_WSF_MS_PER_TICK 10
107-
108106
static void bleLoop()
109107
{
110108
#if CORDIO_ZERO_COPY_HCI
111109
uint64_t last_update_us = 0;
112110
mbed::LowPowerTimer timer;
113111

112+
timer.start();
113+
114114
while (true) {
115115
last_update_us += (uint64_t) timer.read_high_resolution_us();
116116
timer.reset();
117117

118118
uint64_t last_update_ms = (last_update_us / 1000);
119-
wsfTimerTicks_t wsf_ticks = (last_update_ms / CORDIO_TRANSPORT_WSF_MS_PER_TICK);
119+
wsfTimerTicks_t wsf_ticks = (last_update_ms / WSF_MS_PER_TICK);
120120

121121
if (wsf_ticks > 0) {
122122
WsfTimerUpdate(wsf_ticks);
@@ -137,9 +137,9 @@ static void bleLoop()
137137
uint64_t time_spent = (uint64_t) timer.read_high_resolution_us();
138138

139139
/* don't bother sleeping if we're already past tick */
140-
if (sleep && (CORDIO_TRANSPORT_WSF_MS_PER_TICK * 1000 > time_spent)) {
140+
if (sleep && (WSF_MS_PER_TICK * 1000 > time_spent)) {
141141
/* sleep to maintain constant tick rate */
142-
uint64_t wait_time_us = CORDIO_TRANSPORT_WSF_MS_PER_TICK * 1000 - time_spent;
142+
uint64_t wait_time_us = WSF_MS_PER_TICK * 1000 - time_spent;
143143
uint64_t wait_time_ms = wait_time_us / 1000;
144144

145145
wait_time_us = wait_time_us % 1000;

0 commit comments

Comments
 (0)