ELEC60013-ES-CW2/lib/es_can/es_can
2022-03-24 21:05:37 +00:00

31 lines
750 B
Plaintext

#include <cstdint>
#ifndef ES_CAN_H
#define ES_CAN_H
// Initialise the CAN module
uint32_t CAN_Init(bool loopback = false);
// Enable the CAN module
uint32_t CAN_Start();
// Set up a recevie filter
// Defaults to receive everything
uint32_t setCANFilter(uint32_t filterID = 0, uint32_t maskID = 0, uint32_t filterBank = 0);
// Send a message
uint32_t CAN_TX(uint32_t ID, uint8_t data[8]);
// Get the number of received messages
uint32_t CAN_CheckRXLevel();
// Get a received message from the FIFO
uint32_t CAN_RX(uint32_t &ID, uint8_t data[8]);
// Set up an interrupt on received messages
uint32_t CAN_RegisterRX_ISR(void (&callback)());
// Set up an interrupt on transmitted messages
uint32_t CAN_RegisterTX_ISR(void (&callback)());
#endif