Skip to content

Commit f4548d8

Browse files
author
Jarkko Paso
committed
FHSS: Implemented WS configuration structure
1 parent 9a98177 commit f4548d8

File tree

4 files changed

+41
-15
lines changed

4 files changed

+41
-15
lines changed

nanostack/fhss_config.h

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@
2828
extern "C" {
2929
#endif
3030

31+
/**
32+
* @brief WS channel functions.
33+
*/
34+
typedef enum
35+
{
36+
/** Fixed channel. */
37+
WS_FIXED_CHANNEL,
38+
/** TR51 channel function. */
39+
WS_TR51CF,
40+
/** Direct Hash channel function. */
41+
WS_DH1CF,
42+
/** Vendor Defined channel function. */
43+
WS_VENDOR_DEF_CF
44+
} fhss_ws_channel_functions;
45+
3146
/**
3247
* \brief Struct fhss_tuning_parameter defines FHSS tuning parameters.
3348
* All delays are given in microseconds.
@@ -63,6 +78,28 @@ typedef struct fhss_configuration
6378

6479
} fhss_configuration_t;
6580

81+
/**
82+
* \brief Struct fhss_ws_configuration defines configuration of WS FHSS.
83+
*/
84+
typedef struct fhss_ws_configuration
85+
{
86+
/** WS channel function. */
87+
fhss_ws_channel_functions ws_channel_function;
88+
89+
/** Unicast dwell interval. Range: 15-250 milliseconds. */
90+
uint8_t fhss_uc_dwell_interval;
91+
92+
/** Broadcast interval. Duration between broadcast dwell intervals. Range: 0-16777216 milliseconds. */
93+
uint32_t fhss_broadcast_interval;
94+
95+
/** Broadcast dwell interval. Range: 15-250 milliseconds. */
96+
uint8_t fhss_bc_dwell_interval;
97+
98+
/** Channel mask. */
99+
uint32_t channel_mask[8];
100+
101+
} fhss_ws_configuration_t;
102+
66103
/**
67104
* \brief Struct fhss_timer defines interface between FHSS and FHSS platform timer.
68105
* Application must implement FHSS timer driver which is then used by FHSS with this interface.
@@ -103,12 +140,6 @@ typedef struct fhss_synch_configuration
103140

104141
/** Number of superframes. */
105142
uint8_t fhss_number_of_superframes;
106-
107-
/** Broadcast interval. Interval between started broadcast channels. (milliseconds) */
108-
uint32_t fhss_broadcast_interval;
109-
110-
/** Broadcast dwell time. (milliseconds) */
111-
uint8_t fhss_bc_dwell_interval;
112143
} fhss_synch_configuration_t;
113144

114145

nanostack/net_fhss.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extern fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration
4545
* @param fhss_statistics FHSS statistics storage.
4646
* @return New FHSS instance if successful, NULL otherwise.
4747
*/
48-
extern fhss_api_t *ns_fhss_ws_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics);
48+
extern fhss_api_t *ns_fhss_ws_create(const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer);
4949

5050
/**
5151
* @brief Set synchronization time configuration for FHSS network. Should be only called from Border router.

source/Service_Libs/fhss/fhss_configuration_interface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration, const
4646
return this;
4747
}
4848

49-
fhss_api_t *ns_fhss_ws_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics)
49+
fhss_api_t *ns_fhss_ws_create(const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer)
5050
{
5151
fhss_api_t *this = ns_dyn_mem_alloc(sizeof(fhss_api_t));
5252
if (!this) {
5353
return NULL;
5454
}
5555
// Create FHSS object
56-
fhss_structure_t *fhss_struct = fhss_enable(this, fhss_configuration, fhss_timer, fhss_statistics);
56+
fhss_structure_t *fhss_struct = fhss_enable(this, fhss_configuration, fhss_timer);
5757
if (!fhss_struct) {
5858
tr_err("Failed to enable FHSS");
5959
ns_dyn_mem_free(this);

source/Service_Libs/fhss/fhss_ws.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,9 @@
1818
#define FHSS_WS_H_
1919
typedef struct fhss_ws fhss_ws_t;
2020

21-
#define WS_FIXED_CHANNEL 0
22-
#define WS_TR51CF 1
23-
#define WS_DH1CF 2
24-
#define WS_VENDOR_DEF_CF 3
25-
2621
struct fhss_ws
2722
{
28-
uint8_t channel_function;
23+
fhss_ws_channel_functions channel_function;
2924
uint16_t slot;
3025
};
3126

0 commit comments

Comments
 (0)