Added explicit types for TSCH timeslot timings in usec and ticks

This commit is contained in:
Simon Duquennoy 2019-02-24 15:48:56 +01:00
parent e3f1b67096
commit 6debe1b21b
7 changed files with 14 additions and 8 deletions

View File

@ -57,7 +57,7 @@
#define CC13XX_TSCH_DEFAULT_TS_TIMESLOT_LENGTH 40000
/* TSCH timeslot timing (microseconds) */
const uint16_t tsch_timing_cc13xx_50kbps[tsch_ts_elements_count] = {
const tsch_timeslot_timing_usec tsch_timing_cc13xx_50kbps = {
CC13XX_TSCH_DEFAULT_TS_CCA_OFFSET,
CC13XX_TSCH_DEFAULT_TS_CCA,
CC13XX_TSCH_DEFAULT_TS_TX_OFFSET,

View File

@ -94,7 +94,7 @@ static const char rf_cfg_descriptor[] = "802.15.4g 863-870MHz MR-FSK mode #1";
)
/* TSCH timeslot timing (mircoseconds) */
static const uint16_t cc1200_50kbps_tsch_timing[tsch_ts_elements_count] = {
static const tsch_timeslot_timing_usec cc1200_50kbps_tsch_timing = {
CC1200_TSCH_DEFAULT_TS_CCA_OFFSET,
CC1200_TSCH_DEFAULT_TS_CCA,
CC1200_TSCH_DEFAULT_TS_TX_OFFSET,

View File

@ -86,7 +86,7 @@ static const char rf_cfg_descriptor[] = "868MHz 2-GFSK 1000 kbps";
)
/* TSCH timeslot timing (in rtimer ticks) */
static const uint16_t cc1200_1000kbps_tsch_timing[tsch_ts_elements_count] = {
static const tsch_timeslot_timing_usec cc1200_1000kbps_tsch_timing = {
CC1200_TSCH_DEFAULT_TS_CCA_OFFSET,
CC1200_TSCH_DEFAULT_TS_CCA,
CC1200_TSCH_DEFAULT_TS_TX_OFFSET,

View File

@ -45,7 +45,7 @@
* \brief 15ms TSCH timeslot timings, required for cc2420 platforms as
* they are unable to keep up with the defulat 10ms timeslots.
*/
const uint16_t tsch_timeslot_timing_us_15000[tsch_ts_elements_count] = {
const tsch_timeslot_timing_usec tsch_timeslot_timing_us_15000= {
1800, /* CCAOffset */
128, /* CCA */
4000, /* TxOffset */

View File

@ -61,7 +61,7 @@
* (TxOffset - (RxWait / 2)) instead
*/
const uint16_t tsch_timeslot_timing_us_10000[tsch_ts_elements_count] = {
const tsch_timeslot_timing_usec tsch_timeslot_timing_us_10000 = {
1800, /* CCAOffset */
128, /* CCA */
2120, /* TxOffset */

View File

@ -142,6 +142,12 @@ enum tsch_timeslot_timing_elements {
tsch_ts_elements_count, /* Not a timing element */
};
/** \brief TSCH timeslot timing elements in rtimer ticks */
typedef rtimer_clock_t tsch_timeslot_timing_ticks[tsch_ts_elements_count];
/** \brief TSCH timeslot timing elements in micro-seconds */
typedef uint16_t tsch_timeslot_timing_usec[tsch_ts_elements_count];
/** \brief Stores data about an incoming packet */
struct input_packet {
uint8_t payload[TSCH_PACKET_MAX_LEN]; /* Packet payload */

View File

@ -167,9 +167,9 @@ extern uint8_t tsch_current_channel;
extern uint8_t tsch_hopping_sequence[TSCH_HOPPING_SEQUENCE_MAX_LEN];
extern struct tsch_asn_divisor_t tsch_hopping_sequence_length;
/* TSCH timeslot timing (in micro-second) */
extern uint16_t tsch_timing_us[tsch_ts_elements_count];
extern tsch_timeslot_timing_usec tsch_timing_us;
/* TSCH timeslot timing (in rtimer ticks) */
extern rtimer_clock_t tsch_timing[tsch_ts_elements_count];
extern tsch_timeslot_timing_ticks tsch_timing;
/* Statistics on the current session */
extern unsigned long tx_count;
extern unsigned long rx_count;
@ -177,7 +177,7 @@ extern unsigned long sync_count;
extern int32_t min_drift_seen;
extern int32_t max_drift_seen;
/* The TSCH standard 10ms timeslot timing */
extern const uint16_t tsch_timeslot_timing_us_10000[tsch_ts_elements_count];
extern const tsch_timeslot_timing_usec tsch_timeslot_timing_us_10000;
/* TSCH processes */
PROCESS_NAME(tsch_process);