35 lines
786 B
C
35 lines
786 B
C
#ifndef CAN_MANAGER_H
|
|
#define CAN_MANAGER_H
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "config.h"
|
|
#include "mps_sensor.h"
|
|
|
|
#define CAN_CLASSIC_DLC 8
|
|
#define CAN_FD_MAX_DLC 64
|
|
|
|
typedef struct {
|
|
uint32_t id;
|
|
uint8_t dlc;
|
|
uint8_t data[CAN_FD_MAX_DLC];
|
|
bool is_fd;
|
|
bool brs;
|
|
} CanMessage_t;
|
|
|
|
bool CAN_Init(void);
|
|
bool CAN_Send(const CanMessage_t *msg);
|
|
bool CAN_Available(void);
|
|
bool CAN_Receive(CanMessage_t *msg);
|
|
bool CAN_SendH2Status(const MpsSensorData_t *data);
|
|
bool CAN_SendH2Alarm(const MpsSensorData_t *data);
|
|
bool CAN_SendEnvData(const MpsSensorData_t *data);
|
|
void CAN_HandleInterrupt(void);
|
|
void CAN_GetErrorCounters(uint8_t *txErr, uint8_t *rxErr);
|
|
void CAN_Sleep(void);
|
|
void CAN_Wake(void);
|
|
|
|
#endif // CAN_MANAGER_H
|