From e19de33696461adf05ae47c7d6444e69ead878e7 Mon Sep 17 00:00:00 2001 From: Jarkko Paso Date: Wed, 24 Jan 2018 09:32:03 +0200 Subject: [PATCH] FHSS: WS to use Direct Hash channel function - Not final implementation. --- source/Service_Libs/fhss/fhss_ws.c | 16 +++++++++++++++- sources.mk | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index 75b9c11cbfe..1250dcbb441 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -19,6 +19,13 @@ #include "fhss_api.h" #include "fhss_config.h" #include "fhss_common.h" +#include "channel_functions.h" +#include "ns_trace.h" + +#define TRACE_GROUP "fhss" + +// Enable this flag to use channel traces +#define FHSS_CHANNEL_DEBUG int fhss_ws_handle_state_set(fhss_structure_t *fhss_structure, fhss_states fhss_state) { @@ -33,5 +40,12 @@ void fhss_ws_superframe_callback(fhss_structure_t *fhss_structure) void fhss_ws_update_channel_callback(fhss_structure_t *fhss_structure) { - + uint8_t mac_address[8]; + fhss_structure->callbacks.read_mac_address(fhss_structure->fhss_api, mac_address); + int32_t next_channel = fhss_structure->rx_channel = dh1cf_get_uc_channel_index(fhss_structure->uc_channel_index, mac_address, fhss_structure->number_of_channels); + fhss_structure->uc_channel_index++; +#ifdef FHSS_CHANNEL_DEBUG + tr_info("%"PRIu32" UC %u %u", fhss_structure->platform_functions.fhss_get_timestamp(fhss_structure->fhss_api), fhss_structure->uc_channel_index-1, next_channel); +#endif /*FHSS_CHANNEL_DEBUG*/ + fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, next_channel); } diff --git a/sources.mk b/sources.mk index abc3c853cd0..ae4d5fa0d41 100644 --- a/sources.mk +++ b/sources.mk @@ -93,6 +93,7 @@ SRCS += \ source/Service_Libs/fhss/fhss.c \ source/Service_Libs/fhss/fhss_ws.c \ source/Service_Libs/fhss/fhss_common.c \ + source/Service_Libs/fhss/channel_functions.c \ source/Service_Libs/fhss/channel_list.c \ source/Service_Libs/fnv_hash/fnv_hash.c \ source/Service_Libs/mle_service/mle_service.c \