-
Notifications
You must be signed in to change notification settings - Fork 51
/
can_interface.h
33 lines (27 loc) · 1.02 KB
/
can_interface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef CAN_INTERFACE_H
#define CAN_INTERFACE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
/** Reads a message from the CAN interface.
* @param [out] id A pointer to the variable where the message ID will be stored.
* @param [out] message A buffer where the CAN message will be stored. Should be large enough to contain 8 bytes.
* @param [out] length A pointer to the message length.
* @param [in] retries The number of retries until timeout.
* @returns true if read was successful.
*/
bool can_interface_read_message(uint32_t* id, uint8_t* message, uint8_t* length, uint32_t retries);
/** Sends a message via the CAN interface.
* @param [in] id The CAN ID to address.
* @param [in] message The message data.
* @param [in] length The message length.
* @param [in] retries The number of retries until timeout.
* @returns true if write was successful.
*/
bool can_interface_send_message(uint32_t id, uint8_t* message, uint8_t length, uint32_t retries);
#ifdef __cplusplus
}
#endif
#endif