Skip to content

Commit 78314e8

Browse files
author
Jarkko Paso
committed
FHSS: WS FHSS enable implemented
1 parent d04b818 commit 78314e8

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "fhss_config.h"
2121
#include "fhss.h"
2222
#include "fhss_common.h"
23+
#include "channel_list.h"
2324
#include "channel_functions.h"
2425
#include "fhss_ws.h"
2526
#include "fhss_mac_interface.h"
@@ -34,7 +35,23 @@
3435

3536
fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer)
3637
{
37-
return NULL;
38+
if (!fhss_api || !fhss_configuration || !fhss_timer) {
39+
tr_err("Invalid FHSS enable configuration");
40+
return NULL;
41+
}
42+
int channel_count = channel_list_count_channels(fhss_configuration->channel_mask);
43+
if (channel_count <= 0) {
44+
// There must be at least one configured channel in channel list
45+
return NULL;
46+
}
47+
fhss_structure_t *fhss_struct = fhss_allocate_instance(fhss_api, fhss_timer);
48+
if (!fhss_struct) {
49+
return NULL;
50+
}
51+
fhss_struct->fhss_conf.fhss_ws_configuration = *fhss_configuration;
52+
fhss_struct->number_of_channels = channel_count;
53+
54+
return fhss_struct;
3855
}
3956

4057
static uint32_t fhss_ws_get_sf_timeout_callback(fhss_structure_t *fhss_structure)

0 commit comments

Comments
 (0)