Brian Silverman | 8d3816a | 2017-07-03 18:52:15 -0700 | [diff] [blame] | 1 | #ifndef PERIPHERAL_CAN_H_ |
| 2 | #define PERIPHERAL_CAN_H_ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | // The code defined here calls functions in vesc/vesc_can.h from various |
| 7 | // interrupts and expects them to call back into this file to do something. |
| 8 | |
| 9 | #ifdef __cplusplus |
| 10 | extern "C" { |
| 11 | #endif |
| 12 | |
| 13 | void can_init(void); |
| 14 | |
Brian Silverman | 110205a | 2018-01-15 14:33:50 -0800 | [diff] [blame] | 15 | // Mailbox is 2 or 3 for the two send mailboxes. |
| 16 | int can_send(uint32_t can_id, const unsigned char *data, unsigned int length, |
| 17 | unsigned int mailbox); |
Brian Silverman | 8d3816a | 2017-07-03 18:52:15 -0700 | [diff] [blame] | 18 | |
| 19 | // Sets *length to -1 if there isn't a new piece of data to receive. |
| 20 | void can_receive_command(unsigned char *data, int *length); |
| 21 | |
| 22 | #ifdef __cplusplus |
| 23 | } |
| 24 | #endif |
| 25 | |
| 26 | #endif // PERIPHERAL_CAN_H_ |