![]() |
AvrIO
1.4.5
Bibliothèque C modulaire pour ATMEL AVR
|
Ce module permet de gérer la communication sur le bus CAN (Control Area Network).
La macro AVRIO_CAN_ENABLE doit être définie dans avrio-config.h et dans ce cas, les options peuvent être définies dans le fichier avrio-board-can.h se trouvant dans le même répertoire.
Module en développement, non fonctionnel !
|
Structures de données | |
| union | xCanArbField |
| Champs d'arbitrage. Plus de détails... | |
| union | xCanCtrlField |
| Champs de contrôle. Plus de détails... | |
| struct | xCanFrame |
| Trame CAN. Plus de détails... | |
Fonctions | |
| eCanError | eCanInit (eCanSpecification eType) |
| Initialize CAN interface. Plus de détails... | |
| eCanError | eCanReceiveFrame (xCanFrame *pxFrame) |
| Reads a frame from input buffer. Plus de détails... | |
| eCanError | eCanSendFrame (const xCanFrame *pxFrame) |
| Write a frame from to output buffer. Plus de détails... | |
| eCanError | eCanSetSpeed (eCanSpeed eBaudrate) |
| Sets the CAN baud rate. Plus de détails... | |
| eCanError | eCanTryReceiveFrame (xCanFrame *pxFrame) |
| Réception non bloquante d'une trame. | |
| eCanError | eCanTrySendFrame (const xCanFrame *pxFrame) |
| Transmission non bloquante d'une trame. | |
| uint8_t | ucCanRxAvail (void) |
| Checks if data is available in input buffer. Plus de détails... | |
| void | vCanSetFilter (uint8_t *pucAcceptanceCode, uint8_t *pucAcceptanceMask) |
| Sets the acceptance code and mask. Plus de détails... | |
| void | vCanSetRxTimeout (uint16_t usTimeout) |
| Sets the CAN receive timeout. Plus de détails... | |
| bool | xCanTxFree (void) |
| Checks if there's still space in output buffer. Plus de détails... | |
Définitions de type | |
| typedef union xCanArbField | xCanArbField |
| typedef union xCanCtrlField | xCanCtrlField |
| typedef struct xCanFrame | xCanFrame |
Énumérations | |
| enum | eCanError { CAN_SUCCESS = 0, CAN_TXBUF_FULL = -1, CAN_RXBUF_EMPTY = -2, CAN_ILLEGAL_MOB = -3, CAN_INVALID_SPEED = -4, CAN_PASSIVE = -5, CAN_BUS_OFF = -6, CAN_TIMEOUT = -7 } |
| Codes d'erreur. Plus de détails... | |
| enum | eCanSpecification { CAN_2A = 0x01, CAN_2B = 0x02 } |
| Version de bus CAN. Plus de détails... | |
| enum | eCanSpeed { CAN_SPEED_10K = 0, CAN_SPEED_20K = 1, CAN_SPEED_50K = 2, CAN_SPEED_100K = 3, CAN_SPEED_125K = 4, CAN_SPEED_250K = 5, CAN_SPEED_500K = 6, CAN_SPEED_800K = 7, CAN_SPEED_1M = 8, CAN_SPEED_CUSTOM = 255 } |
| Vitesse bus CAN Baud. Plus de détails... | |
| enum eCanError |
Codes d'erreur.
| enum eCanSpecification |
| enum eCanSpeed |
Vitesse bus CAN Baud.
| eCanError eCanInit | ( | eCanSpecification | eType | ) |
Initialize CAN interface.
Reads a frame from input buffer.
This function reads a frame from the input buffer. If the input buffer is empty the function will block unitl new frames are received, or the timeout is reached.
| pxFrame | Pointer to the receive frame |
Write a frame from to output buffer.
This function writes a frame to the output buffer. If the output buffer is full the function will block until frames are send.
| pxFrame | Pointer to the receive frame |
Sets the CAN baud rate.
| eBaudrate | Baud rate (One of the defined baud rates. See AtCan.h) |
| uint8_t ucCanRxAvail | ( | void | ) |
Checks if data is available in input buffer.
| void vCanSetFilter | ( | uint8_t * | pucAcceptanceCode, |
| uint8_t * | pucAcceptanceMask | ||
| ) |
Sets the acceptance code and mask.
| pucAcceptanceCode | 4 byte char array with the acceptance mask |
| void vCanSetRxTimeout | ( | uint16_t | usTimeout | ) |
Sets the CAN receive timeout.
| usTimeout | Timeout in milliseconds, WAIT_INFINITE = no time-out |
| bool xCanTxFree | ( | void | ) |
Checks if there's still space in output buffer.