Merge branch 'develop' into contrib/tsch-discard-frames-from-ourselves
This commit is contained in:
commit
07c646484b
@ -1031,6 +1031,7 @@ get_object(radio_param_t param, void *dest, size_t size)
|
||||
if(size != sizeof(uint16_t *) || !dest) {
|
||||
return RADIO_RESULT_INVALID_VALUE;
|
||||
}
|
||||
/* Assigned value: a pointer to the TSCH timing in usec */
|
||||
*(const uint16_t **)dest = tsch_timeslot_timing_us_10000;
|
||||
return RADIO_RESULT_OK;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -1449,6 +1449,7 @@ get_object(radio_param_t param, void *dest, size_t size)
|
||||
if(size != sizeof(uint16_t *) || !dest) {
|
||||
return RADIO_RESULT_INVALID_VALUE;
|
||||
}
|
||||
/* Assigned value: a pointer to the TSCH timing in usec */
|
||||
*(const uint16_t **)dest = CC1200_RF_CFG.tsch_timing;
|
||||
return RADIO_RESULT_OK;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -295,6 +295,7 @@ radio_delay_before_detect(void) {
|
||||
uint16_t *
|
||||
radio_tsch_timeslot_timing(void) {
|
||||
uint16_t *ret;
|
||||
/* Get and return pointer to TSCH timings in usec */
|
||||
NETSTACK_RADIO.get_object(RADIO_CONST_TSCH_TIMING, &ret, sizeof(ret));
|
||||
return ret;
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ connect_to_broker(void)
|
||||
{
|
||||
/* Connect to MQTT server */
|
||||
mqtt_connect(&conn, conf.broker_ip, conf.broker_port,
|
||||
conf.pub_interval * 3);
|
||||
(conf.pub_interval * 3) / CLOCK_SECOND);
|
||||
|
||||
state = STATE_CONNECTING;
|
||||
}
|
||||
|
@ -185,11 +185,26 @@ enum {
|
||||
/* The maximum transmission power in dBm. */
|
||||
RADIO_CONST_TXPOWER_MAX,
|
||||
|
||||
/* A pointer to TSCH timings in micro-seconds (tsch_timeslot_timing_usec *) */
|
||||
RADIO_CONST_TSCH_TIMING,
|
||||
|
||||
/* The physical layer header+footer overhead in bytes, after SFD.
|
||||
* On IEEE 802.15.4 at 2.4 GHz: 1 byte for len + 2 for CRC => 3 */
|
||||
RADIO_CONST_PHY_OVERHEAD,
|
||||
|
||||
/* The air time of one byte in usec, e.g. 32 for IEEE 802.15.4 at 2.4 GHz */
|
||||
RADIO_CONST_BYTE_AIR_TIME,
|
||||
|
||||
/* The delay in usec between a call to the radio API's transmit function and
|
||||
* the end of SFD transmission */
|
||||
RADIO_CONST_DELAY_BEFORE_TX,
|
||||
|
||||
/* The delay in usec between turning on the radio and it being actually
|
||||
* listening (able to hear a preamble) */
|
||||
RADIO_CONST_DELAY_BEFORE_RX,
|
||||
|
||||
/* The delay in usec between the end of SFD reception for an incoming frame
|
||||
* and the radio API starting to return receiving_packet() != 0 */
|
||||
RADIO_CONST_DELAY_BEFORE_DETECT,
|
||||
};
|
||||
|
||||
|
@ -416,16 +416,16 @@ PT_THREAD(connect_pt(struct pt *pt, struct mqtt_connection *conn))
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->connect_vhdr_flags);
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->keep_alive >> 8));
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->keep_alive & 0x00FF));
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->client_id.length << 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->client_id.length >> 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->client_id.length & 0x00FF);
|
||||
PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->client_id.string,
|
||||
conn->client_id.length);
|
||||
if(conn->connect_vhdr_flags & MQTT_VHDR_WILL_FLAG) {
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->will.topic.length << 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->will.topic.length >> 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->will.topic.length & 0x00FF);
|
||||
PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->will.topic.string,
|
||||
conn->will.topic.length);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->will.message.length << 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->will.message.length >> 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->will.message.length & 0x00FF);
|
||||
PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->will.message.string,
|
||||
conn->will.message.length);
|
||||
@ -436,14 +436,14 @@ PT_THREAD(connect_pt(struct pt *pt, struct mqtt_connection *conn))
|
||||
conn->will.message.length);
|
||||
}
|
||||
if(conn->connect_vhdr_flags & MQTT_VHDR_USERNAME_FLAG) {
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->credentials.username.length << 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->credentials.username.length >> 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->credentials.username.length & 0x00FF);
|
||||
PT_MQTT_WRITE_BYTES(conn,
|
||||
(uint8_t *)conn->credentials.username.string,
|
||||
conn->credentials.username.length);
|
||||
}
|
||||
if(conn->connect_vhdr_flags & MQTT_VHDR_PASSWORD_FLAG) {
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->credentials.password.length << 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->credentials.password.length >> 8);
|
||||
PT_MQTT_WRITE_BYTE(conn, conn->credentials.password.length & 0x00FF);
|
||||
PT_MQTT_WRITE_BYTES(conn,
|
||||
(uint8_t *)conn->credentials.password.string,
|
||||
@ -534,7 +534,7 @@ PT_THREAD(subscribe_pt(struct pt *pt, struct mqtt_connection *conn))
|
||||
conn->out_packet.remaining_length_enc,
|
||||
conn->out_packet.remaining_length_enc_bytes);
|
||||
/* Write Variable Header */
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid << 8));
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid >> 8));
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid & 0x00FF));
|
||||
/* Write Payload */
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.topic_length >> 8));
|
||||
@ -596,7 +596,7 @@ PT_THREAD(unsubscribe_pt(struct pt *pt, struct mqtt_connection *conn))
|
||||
PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->out_packet.remaining_length_enc,
|
||||
conn->out_packet.remaining_length_enc_bytes);
|
||||
/* Write Variable Header */
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid << 8));
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid >> 8));
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid & 0x00FF));
|
||||
/* Write Payload */
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.topic_length >> 8));
|
||||
@ -669,7 +669,7 @@ PT_THREAD(publish_pt(struct pt *pt, struct mqtt_connection *conn))
|
||||
PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->out_packet.topic,
|
||||
conn->out_packet.topic_length);
|
||||
if(conn->out_packet.qos > MQTT_QOS_LEVEL_0) {
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid << 8));
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid >> 8));
|
||||
PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid & 0x00FF));
|
||||
}
|
||||
/* Write Payload */
|
||||
@ -772,7 +772,7 @@ handle_connack(struct mqtt_connection *conn)
|
||||
static void
|
||||
handle_pingresp(struct mqtt_connection *conn)
|
||||
{
|
||||
DBG("MQTT - Got RINGRESP\n");
|
||||
DBG("MQTT - Got PINGRESP\n");
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user