ams-master-23/Core/Inc/can.h

33 lines
922 B
C
Raw Normal View History

2023-03-12 21:06:23 +01:00
#ifndef INC_CAN_H
#define INC_CAN_H
#include "stm32f3xx_hal.h"
#include "stm32f3xx_hal_can.h"
#include "stm32f3xx_hal_def.h"
2023-04-30 00:57:42 +02:00
#include "ts_state_machine.h"
2023-03-12 21:06:23 +01:00
#define CAN_ID_SLAVE_PANIC 0x009
#define CAN_ID_AMS_STATUS 0x00A
#define CAN_ID_AMS_IN 0x00B
2023-04-30 00:57:42 +02:00
#define CAN_ID_AMS_ERROR 0x00C
#define CAN_ID_SLAVE_STATUS_BASE 0x080
2023-03-12 21:06:23 +01:00
#define CAN_ID_SLAVE_LOG 0x4F4
#define CAN_ID_SHUNT_BASE 0x520
#define CAN_ID_SHUNT_CURRENT 0x521
#define CAN_ID_SHUNT_VOLTAGE1 0x522
#define CAN_ID_SHUNT_VOLTAGE2 0x523
#define CAN_ID_SHUNT_VOLTAGE3 0x524
#define CAN_ID_SHUNT_TEMP 0x525
#define CAN_ID_SHUNT_POWER 0x526
#define CAN_ID_SHUNT_CURRENT_COUNTER 0x527
#define CAN_ID_SHUNT_ENERGY_COUNTER 0x528
void can_init(CAN_HandleTypeDef *handle);
HAL_StatusTypeDef can_send_status();
2023-04-30 00:57:42 +02:00
HAL_StatusTypeDef can_send_error(TSErrorKind kind, uint8_t arg);
2023-03-12 21:06:23 +01:00
2023-03-15 18:07:38 +01:00
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data);
2023-03-12 21:06:23 +01:00
#endif // INC_CAN_H