Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 0f9f0bb

Browse files
author
Jarkko Paso
committed
FHSS: Platform API to support multiple simultaneous timeouts
1 parent 209e49a commit 0f9f0bb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

nanostack/fhss_config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ typedef struct fhss_configuration
6969
*/
7070
typedef struct fhss_timer
7171
{
72-
/** Start timeout (1us) */
72+
/** Start timeout (1us). Timer must support multiple simultaneous timeouts */
7373
int (*fhss_timer_start)(uint32_t, void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api);
7474

7575
/** Stop timeout */
76-
int (*fhss_timer_stop)(const fhss_api_t *fhss_api);
76+
int (*fhss_timer_stop)(void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api);
7777

7878
/** Get remaining time of started timeout*/
79-
uint32_t (*fhss_get_remaining_slots)(const fhss_api_t *fhss_api);
79+
uint32_t (*fhss_get_remaining_slots)(void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api);
8080

8181
/** Get timestamp since initialization of driver. Overflow of 32-bit counter is allowed (1us) */
8282
uint32_t (*fhss_get_timestamp)(const fhss_api_t *fhss_api);

source/Service_Libs/fhss/fhss.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static int fhss_reset_synch_monitor(fhss_synch_monitor_s *synch_monitor, bool re
311311
static int fhss_reset(fhss_structure_t *fhss_structure)
312312
{
313313
if (fhss_structure) {
314-
fhss_structure->platform_functions.fhss_timer_stop(fhss_structure->fhss_api);
314+
fhss_structure->platform_functions.fhss_timer_stop(fhss_superframe_handler, fhss_structure->fhss_api);
315315
fhss_struct->synch_panid = 0xffff;
316316
fhss_beacon_periodic_stop(fhss_structure);
317317
fhss_struct->current_superframe = 0;
@@ -374,7 +374,7 @@ void fhss_start_timer(fhss_structure_t *fhss_structure, uint32_t time, void (*ca
374374

375375
uint32_t fhss_get_remaining_time_to_next_superframe(const fhss_structure_t *fhss_structure)
376376
{
377-
const uint32_t slots = fhss_structure->platform_functions.fhss_get_remaining_slots(fhss_structure->fhss_api);
377+
const uint32_t slots = fhss_structure->platform_functions.fhss_get_remaining_slots(fhss_superframe_handler, fhss_structure->fhss_api);
378378
const uint32_t time = slots * fhss_structure->platform_functions.fhss_resolution_divider;
379379
return time;
380380
}
@@ -657,7 +657,7 @@ int fhss_sync_with_beacon(fhss_structure_t *fhss_structure,
657657
fhss_structure->uc_channel_index -= (fhss_structure->number_of_channels - payload->number_of_broadcast_channels);
658658
}
659659

660-
fhss_structure->platform_functions.fhss_timer_stop(fhss_structure->fhss_api);
660+
fhss_structure->platform_functions.fhss_timer_stop(fhss_superframe_handler, fhss_structure->fhss_api);
661661
// start timer to elapse at approximately same time as the parent will.
662662
const int32_t time_to_next_superframe = payload->remaining_slots;
663663
remaining_time_own = fhss_get_remaining_time_to_next_superframe(fhss_structure);

0 commit comments

Comments
 (0)