X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fnet%2Fkeytag.h;h=ee8258c380fdd1e30a5933ebef2d23a234f56816;hb=4d8a6a97c6c0e15296b51d5f02674079bede1aa0;hp=0985a2071d950fd2fb3491e86902aeff0bf6c5aa;hpb=52b1a686cb873aafb09a7b0c19716bea252b7946;p=bertos.git diff --git a/bertos/net/keytag.h b/bertos/net/keytag.h index 0985a207..ee8258c3 100644 --- a/bertos/net/keytag.h +++ b/bertos/net/keytag.h @@ -33,48 +33,37 @@ * \author Andrea Grandi * * \brief Tag protocol. (interface). + * + * $WIZ$ module_name = "keytag" + * $WIZ$ module_configuration = "bertos/cfg/cfg_keytag.h" + * $WIZ$ module_depends = "kfile" + * $WIZ$ module_hw = "" */ #ifndef NET_KEYTAG_H #define NET_KEYTAG_H -#include -#include +#include "cfg/cfg_keytag.h" +#include -/** - * Starting communication char (STX). - */ -#define TAG_STX 0x02 +#include -/** - * Ending communication char (ETX). - */ -#define TAG_ETX 0x03 - -/** - * Max buffer lenght - */ -#define TAG_MAX_LEN 14 - - -/** - * Max number of chars to print in the communication serial - */ -#define TAG_MAX_PRINT_CHARS 12 /** * Structure of a Tag packet */ typedef struct TagPacket { - KFile *tag; ///< Tag communication channel - KFile *host; ///< Host communication channel - bool sync; ///< Status flag: true if we find an STX - uint16_t len; ///< Packet lenght - uint8_t buf[TAG_MAX_LEN]; ///< Reception buffer + KFile *tag; ///< Tag communication channel + KFile *host; ///< Host communication channel + bool sync; ///< Status flag: true if we find an STX + size_t len; ///< Packet lenght + uint8_t buf[CONFIG_TAG_MAX_LEN]; ///< Reception buffer } TagPacket; void keytag_init(struct TagPacket *pkt, struct KFile *comm, struct KFile *tag); -void keytag_poll(struct TagPacket *pkt); +int keytag_recv(struct TagPacket *pkt, uint8_t *tag, size_t len); + +DEPRECATED void keytag_poll(struct TagPacket *pkt); #endif /* NET_TAG_H */