blob: 54bdce8490f7555f4283fd58616f24da33bc3fe0 [file] [log] [blame]
Brian Silverman8d3816a2017-07-03 18:52:15 -07001#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
10extern "C" {
11#endif
12
Brian Silverman7c7170e2018-01-13 17:41:21 -080013void can_init(uint32_t id0, uint32_t id1);
Brian Silverman8d3816a2017-07-03 18:52:15 -070014
Brian Silverman110205a2018-01-15 14:33:50 -080015// Mailbox is 2 or 3 for the two send mailboxes.
16int can_send(uint32_t can_id, const unsigned char *data, unsigned int length,
17 unsigned int mailbox);
Brian Silverman8d3816a2017-07-03 18:52:15 -070018
19// Sets *length to -1 if there isn't a new piece of data to receive.
Brian Silverman7c7170e2018-01-13 17:41:21 -080020// Mailbox is 0 or 1 for the two receive mailboxes.
21void can_receive_command(unsigned char *data, int *length, int mailbox);
Brian Silverman8d3816a2017-07-03 18:52:15 -070022
23#ifdef __cplusplus
24}
25#endif
26
27#endif // PERIPHERAL_CAN_H_