![]() |
AvrIO
1.4.5
Bibliothèque C modulaire pour ATMEL AVR
|
Ce module fournit des fonctions permettant des gérer les liaisons par trames avec contrôle d'erreur.
Les messages ont le format suivant:
<SOH><STX>[Data Hexa ASCII]<ETX>[CRC CCITT Hexa ASCII]<EOT>
![]() |
Fonctions | |
int | iTncError (struct xTnc *tnc) |
int | iTncPoll (struct xTnc *tnc) |
ssize_t | iTncWrite (struct xTnc *tnc, const void *buf, size_t count) |
void | vTncClear (struct xTnc *p) |
void | vTncInit (struct xTnc *p, FILE *fin, FILE *fout) |
Macros | |
#define | TNC_CRC 6 |
#define | TNC_EOT 4 |
#define | TNC_ETX 3 |
#define | TNC_SOH 1 |
#define | TNC_STX 2 |
#define | TNC_TXT 5 |
Énumérations | |
enum | eTncError { TNC_SUCCESS = 0, TNC_CRC_ERROR = -1, TNC_NOT_ENOUGH_MEMORY = -2, TNC_OBJECT_NOT_FOUND = -3, TNC_ILLEGAL_MSG = -4, TNC_FILE_NOT_FOUND = -5, TNC_IO_ERROR = -6 } |
enum eTncError |
List of error codes returned by the functions.
int iTncError | ( | struct xTnc * | tnc | ) |
Retruns the last error code.
int iTncPoll | ( | struct xTnc * | tnc | ) |
Check if there are any TNC messages to be processed. This function read available characters from the medium and search for any TNC messages. If a message is found, this function return true and the message can be read with iTncRead(). This function may be blocking if there are no available chars and the FILE used in tnc to access the medium is configured in blocking mode.
tnc | TNC object to operate on. |
ssize_t iTncWrite | ( | struct xTnc * | tnc, |
const void * | buf, | ||
size_t | count | ||
) |
Send an TNC message
tnc | TNC object to operate on. |
frame | message to send |
void vTncClear | ( | struct xTnc * | p | ) |
Clear all fields of the object
void vTncInit | ( | struct xTnc * | p, |
FILE * | fin, | ||
FILE * | fout | ||
) |
Create and initialize a new xTnc object
This object should be deleted with vTncDelete()