tsch-packet: define constant for frame pending bit offset
*/
static struct packetbuf_attr eackbuf_attrs[PACKETBUF_NUM_ATTRS];
+/* The offset of the frame pending bit flag within the first byte of FCF */
+#define IEEE802154_FRAME_PENDING_BIT_OFFSET 4
+
/*---------------------------------------------------------------------------*/
static int
tsch_packet_eackbuf_set_attr(uint8_t type, const packetbuf_attr_t val)
@@ -463,14 +466,14 @@ tsch_packet_parse_eb(const uint8_t *buf, int buf_size,
void
tsch_packet_set_frame_pending(uint8_t *buf, int buf_size)
{
- buf[0] |= (1 << 4);
+ buf[0] |= (1 << IEEE802154_FRAME_PENDING_BIT_OFFSET);
}
/*---------------------------------------------------------------------------*/
/* Get frame pending bit from a packet */
int
tsch_packet_get_frame_pending(uint8_t *buf, int buf_size)
{
- return (buf[0] >> 4) & 1;
+ return (buf[0] >> IEEE802154_FRAME_PENDING_BIT_OFFSET) & 1;
}
/*---------------------------------------------------------------------------*/
/** @} */
