|
AtMega CAN Library
Well documented CAN library for AtMega processors utilizing the original Atmel driver
|
Functions | |
| uint8_t | can_getRxBufferLength () |
| Returns the number of messages in the buffer. More... | |
| int | canbuf_add (canMessage **m) |
| int | canbuf_remove (canMessage *m) |
| int8_t | can_hasFreeTxBuffer () |
| Check if there are ant free transmitting MOBs. More... | |
| void | can_enableTransciever () |
| void | can_disableTransciever () |
| uint8_t | can_init () |
| Initialize the bus and activate hardware. More... | |
| void | can_close () |
| Disable driver & hardware. More... | |
| uint8_t | can_sendMessage (canMessage *m) |
| Sends a can message. More... | |
| int8_t | can_getMessage (canMessage *m) |
| Gets a can message from the reception buffer. More... | |
| SIGNAL (CAN_TOVF_vect) | |
| SIGNAL (CAN_INT_vect) | |
Variables | |
| volatile unsigned char | msg_received = 0 |
| volatile uint32_t | cantimecounter = 0 |
| #define | RING_SIZE 32 |
| volatile uint8_t | ring_head |
| volatile uint8_t | ring_tail |
| volatile canMessage | ring_data [RING_SIZE] |
CAN library for AtMega64C1. (license: GPLv2 or LGPLv2.1)
| void can_close | ( | ) |
Disable driver & hardware.
Disabled the driver and the transciever if the option has been configured.
| int8_t can_getMessage | ( | canMessage * | m | ) |
Gets a can message from the reception buffer.
| m | Pointer to message. |
| -1 | No message in buffer. |
| n | Number of messages in buffer. |
Retrieves a message from the internal circular buffer and returns the amount of messages left in the buffer OR CAN_BUFFEREMPTY if the buffer is empty. You may use either:
or
depending on your implementation, buffer length and bus speed.
| uint8_t can_getRxBufferLength | ( | ) |
Returns the number of messages in the buffer.
| int8_t can_hasFreeTxBuffer | ( | ) |
Check if there are ant free transmitting MOBs.
| -1 | No buffers |
| n | free buffer. |
| uint8_t can_init | ( | ) |
Initialize the bus and activate hardware.
| 0 | Init/autobaud failure. |
| 1 | Init/autobaud success. |
Initializes the driver, speed and also activates the transciever if the option has been configured.
| uint8_t can_sendMessage | ( | canMessage * | m | ) |
Sends a can message.
| m | Pointer to a canMessage object that has been configured. |
| 0 | Message NOT sent. |
| 1 | Message sent. |
Sends a canmessage with the configured id and data. Usage example:
1.8.13