stm32: Add support for reporting canbus state from can.c

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2025-01-14 15:26:05 -05:00
parent d57fe4395e
commit 6cdcf75e6b
2 changed files with 57 additions and 2 deletions

View File

@@ -17,9 +17,20 @@ struct canbus_msg {
#define CANMSG_DATA_LEN(msg) ((msg)->dlc > 8 ? 8 : (msg)->dlc)
struct canbus_status {
uint32_t rx_error, tx_error, tx_retries;
uint32_t bus_state;
};
enum {
CANBUS_STATE_ACTIVE, CANBUS_STATE_WARN, CANBUS_STATE_PASSIVE,
CANBUS_STATE_OFF,
};
// callbacks provided by board specific code
int canhw_send(struct canbus_msg *msg);
void canhw_set_filter(uint32_t id);
void canhw_get_status(struct canbus_status *status);
// canbus.c
int canbus_send(struct canbus_msg *msg);