From 0206fc8b5a72bc26747275b311d328d37e3d0900 Mon Sep 17 00:00:00 2001 From: Jarkko Paso Date: Tue, 28 Aug 2018 12:48:22 +0300 Subject: [PATCH] FHSS: Added callbacks for debugging purposes --- source/Service_Libs/fhss/fhss_ws.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index 5dfdef814da..4cca56f58cc 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -34,6 +34,13 @@ // Enable this flag to use channel traces // #define FHSS_CHANNEL_DEBUG +// Enable this flag to use debug callbacks +// #define FHSS_CHANNEL_DEBUG_CBS + +#ifdef FHSS_CHANNEL_DEBUG_CBS +void (*fhss_uc_switch)(void) = NULL; +void (*fhss_bc_switch)(void) = NULL; +#endif /*FHSS_CHANNEL_DEBUG_CBS*/ #define DEF_2E24 0x1000000 #define IE_HEADER_LENGTH_MASK 0x007f @@ -135,6 +142,11 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay) #endif /*FHSS_CHANNEL_DEBUG*/ } fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, next_channel); +#ifdef FHSS_CHANNEL_DEBUG_CBS + if (fhss_bc_switch) { + fhss_bc_switch(); + } +#endif /*FHSS_CHANNEL_DEBUG_CBS*/ fhss_ws_start_tx_poll_timer(fhss_structure, fhss_structure->callbacks.read_tx_queue_size(fhss_structure->fhss_api, true), fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval); } @@ -255,6 +267,11 @@ static void fhss_ws_update_uc_channel_callback(fhss_structure_t *fhss_structure) tr_info("%"PRIu32" UC %u %u", fhss_structure->platform_functions.fhss_get_timestamp(fhss_structure->fhss_api), next_channel, fhss_structure->ws->uc_slot); #endif /*FHSS_CHANNEL_DEBUG*/ fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, next_channel); +#ifdef FHSS_CHANNEL_DEBUG_CBS + if (fhss_uc_switch) { + fhss_uc_switch(); + } +#endif /*FHSS_CHANNEL_DEBUG_CBS*/ } 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)