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 20
20
#include "fhss_config.h"
21
21
#include "fhss.h"
22
22
#include "fhss_common.h"
23
+ #include "channel_list.h"
23
24
#include "channel_functions.h"
24
25
#include "fhss_ws.h"
25
26
#include "fhss_mac_interface.h"
34
35
35
36
fhss_structure_t * fhss_ws_enable (fhss_api_t * fhss_api , const fhss_ws_configuration_t * fhss_configuration , const fhss_timer_t * fhss_timer )
36
37
{
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 ;
38
55
}
39
56
40
57
static 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