Skip to content

Commit 0206fc8

Browse files
author
Jarkko Paso
committed
FHSS: Added callbacks for debugging purposes
1 parent f39312b commit 0206fc8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434

3535
// Enable this flag to use channel traces
3636
// #define FHSS_CHANNEL_DEBUG
37+
// Enable this flag to use debug callbacks
38+
// #define FHSS_CHANNEL_DEBUG_CBS
39+
40+
#ifdef FHSS_CHANNEL_DEBUG_CBS
41+
void (*fhss_uc_switch)(void) = NULL;
42+
void (*fhss_bc_switch)(void) = NULL;
43+
#endif /*FHSS_CHANNEL_DEBUG_CBS*/
3744

3845
#define DEF_2E24 0x1000000
3946
#define IE_HEADER_LENGTH_MASK 0x007f
@@ -135,6 +142,11 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay)
135142
#endif /*FHSS_CHANNEL_DEBUG*/
136143
}
137144
fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, next_channel);
145+
#ifdef FHSS_CHANNEL_DEBUG_CBS
146+
if (fhss_bc_switch) {
147+
fhss_bc_switch();
148+
}
149+
#endif /*FHSS_CHANNEL_DEBUG_CBS*/
138150
fhss_ws_start_tx_poll_timer(fhss_structure, fhss_structure->callbacks.read_tx_queue_size(fhss_structure->fhss_api, true),
139151
fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval);
140152
}
@@ -255,6 +267,11 @@ static void fhss_ws_update_uc_channel_callback(fhss_structure_t *fhss_structure)
255267
tr_info("%"PRIu32" UC %u %u", fhss_structure->platform_functions.fhss_get_timestamp(fhss_structure->fhss_api), next_channel, fhss_structure->ws->uc_slot);
256268
#endif /*FHSS_CHANNEL_DEBUG*/
257269
fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, next_channel);
270+
#ifdef FHSS_CHANNEL_DEBUG_CBS
271+
if (fhss_uc_switch) {
272+
fhss_uc_switch();
273+
}
274+
#endif /*FHSS_CHANNEL_DEBUG_CBS*/
258275
}
259276

260277
static int fhss_ws_tx_handle_callback(const fhss_api_t *api, bool is_broadcast_addr, uint8_t *destination_address, int frame_type, uint16_t frame_length, uint8_t phy_header_length, uint8_t phy_tail_length, uint32_t tx_time)

0 commit comments

Comments
 (0)