X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fnet%2Fkeytag.h;h=f086bc3419b1a856ae7e6245a01d31f406c4cc04;hb=391b4f8d9c82c413f2cd11fb3ba3aeb311f62184;hp=541005ea694c9fdb969cce3b637098ef186e5d3d;hpb=791e167e053bdd9250d34a9a5ccae6ccde4d6679;p=bertos.git diff --git a/bertos/net/keytag.h b/bertos/net/keytag.h index 541005ea..f086bc34 100644 --- a/bertos/net/keytag.h +++ b/bertos/net/keytag.h @@ -33,50 +33,36 @@ * \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 - -/** - * Starting communication char (STX). - */ -#define TAG_STX 0x02 - -/** - * Ending communication char (ETX). - */ -#define TAG_ETX 0x03 +#include -/** - * Max buffer lenght - */ -#define TAG_MAX_LEN 14 +#include -#define TAG_SER_PORT 0 -#define TAG_SER_BAUDRATE 9600 - -/** - * Max number of chars to print in the communication serial - */ -#define TAG_MAX_PRINT_CHARS 12 /** * Structure of a Tag packet */ typedef struct TagPacket { - KFileSerial *tag_ser; // Tag serial - KFileSerial *comm_ser; // Communication serial - 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); +void keytag_init(struct TagPacket *pkt, struct KFile *comm, struct KFile *tag); +int keytag_recv(struct TagPacket *pkt, uint8_t *tag, size_t len); + void keytag_poll(struct TagPacket *pkt); #endif /* NET_TAG_H */