Add kbd_peekMask() and kbd_getMask() functions.
[bertos.git] / bertos / net / ax25.h
index 4eb77f6de0501e6b6c5c84a67a5d1ef3a1dff66a..b8ebe47cf76de0a13ec3af0849a29cf19e4766a1 100644 (file)
@@ -106,6 +106,11 @@ typedef struct AX25Call
  */
 #define AX25_MAX_RPT 8
 
+/*
+ * Has to be lesser than 8 in order to fit in one byte
+ * change AX25Msg.rpt_flags if you need more repeaters.
+ */
+STATIC_ASSERT(AX25_MAX_RPT <= 8);
 
 /**
  * AX25 Message.
@@ -118,6 +123,8 @@ typedef struct AX25Msg
        #if CONFIG_AX25_RPT_LST
        AX25Call rpt_lst[AX25_MAX_RPT]; ///< List of repeaters
        uint8_t rpt_cnt; ///< Number of repeaters in this message
+       uint8_t rpt_flags; ///< Has-been-repeated flags for each repeater (bit-mapped)
+       #define AX25_REPEATED(msg, idx) ((msg)->rpt_flags & BV(idx))
        #endif
        uint16_t ctrl; ///< AX25 control field
        uint8_t pid;   ///< AX25 PID field
@@ -125,6 +132,7 @@ typedef struct AX25Msg
        size_t len;    ///< Payload length
 } AX25Msg;
 
+
 #define AX25_CTRL_UI      0x03
 #define AX25_PID_NOLAYER3 0xF0
 
@@ -175,7 +183,7 @@ void ax25_sendVia(AX25Ctx *ctx, const AX25Call *path, size_t path_len, const voi
  *
  * \see ax25_sendVia() if you want to send a frame with a specific path.
  */
-#define ax25_send(ctx, dst, src, buf, len) ax25_sendVia(ctx, ({static AX25Call __path[]={dst, src}; __path;}), 2, buf, len)
+#define ax25_send(ctx, dst, src, buf, len) ax25_sendVia(ctx, ({static AX25Call __path[]={dst, src}; (AX25Call *)&__path;}), 2, buf, len)
 void ax25_init(AX25Ctx *ctx, KFile *channel, ax25_callback_t hook);
 
 void ax25_print(KFile *ch, const AX25Msg *msg);