File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 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"
3435
3536fhss_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
4057static uint32_t fhss_ws_get_sf_timeout_callback (fhss_structure_t * fhss_structure )
You can’t perform that action at this time.
0 commit comments