32 "bxCAN Mailbox register struct size mismatch. Is it aligned?");
42_Static_assert((
sizeof(
struct bxCANFilterRegs)) == (
sizeof(uint32_t) * 2U),
43 "bxCAN Filter register struct size mismatch. Is it aligned?");
72_Static_assert((
sizeof(
struct bxCANRegs)) == (
sizeof(uint32_t) * 200U),
73 "bxCAN register struct size mismatch. Is it aligned?");
75#define CAN(NUM) (struct bxCANRegs *)(CAN1_BASE + (0x400UL * (uint8_t)NUM))
94_Static_assert((
sizeof(
struct bxCANISR)) == (
sizeof(uint8_t) * 2U),
95 "bxCAN ISR struct size mismatch. Is it aligned?");
107 "bxCAN Bitrate config struct size mismatch. Is it aligned?");
113 uint16_t FilterID[2];
114 uint16_t FilterIDMask[2];
116 _Bool SingleScale : 1;
122 "bxCAN Filter config struct size mismatch. Is it aligned?");
125 _Bool AutoBusOff : 1;
126 _Bool AutoWakeUp : 1;
135 volatile uint32_t ID;
138 volatile uint8_t DLC;
140 volatile uint16_t TIME;
143 volatile uint8_t DATA[8];
148_Static_assert((
sizeof(
struct bxCANFrame)) == (
sizeof(uint8_t) * 18U),
149 "bxCAN Frame struct size mismatch. Is it aligned?");
163_Static_assert((
sizeof(
struct bxCANErrorInfo)) == (
sizeof(uint8_t) * 6U),
164 "bxCAN Error info struct size mismatch. Is it aligned?");
172 BXCAN_PERIPH_1 = 0x0,
175 BXCAN_PERIPH_2 = 0x1,
184 BXCAN_MODE_INIT = 0x0,
193 BXCAN_TEST_MODE_NONE = 0x0,
194 BXCAN_TEST_MODE_LOOP,
195 BXCAN_TEST_MODE_SLNT,
203 BXCAN_FIFO_PRIORITY_ID = 0x0,
204 BXCAN_FIFO_PRIORITY_RQ,
317 const uint8_t filters);
enum bxcan_mode bxcan_mode_t
Available bxCAN operation modes.
void bxcan_set_filter_start(const bxcan_peripheral_t can, const uint8_t filters)
Sets the desired bxCAN filter start bank.
Definition bxcan.c:174
void bxcan_configure_filter(const bxcan_peripheral_t can, const uint8_t filter, const struct bxCANFilterConfig config)
Configures the bxCAN filter according to config.
Definition bxcan.c:194
bxcan_fifo_priority
Available bxCAN FIFO priorities.
Definition bxcan.h:202
void bxcan_configure_bitrate(const bxcan_peripheral_t can, const struct bxCANBitrateConfig config)
Configures the bxCAN bitrate according to config.
Definition bxcan.c:121
void bxcan_configure_fifo(const bxcan_peripheral_t can, const _Bool lock, const bxcan_fifo_priority_t priority)
Configures the bxCAN FIFO according to config.
Definition bxcan.c:158
enum bxcan_fifo_priority bxcan_fifo_priority_t
Available bxCAN FIFO priorities.
void bxcan_set_test_mode(const bxcan_peripheral_t can, const bxcan_test_mode_t mode)
Configures bxCAN test mode features.
Definition bxcan.c:54
bxcan_test_mode
Available bxCAN test modes.
Definition bxcan.h:192
bxcan_mode
Available bxCAN operation modes.
Definition bxcan.h:183
const struct bxCANErrorInfo bxcan_get_error_info(const bxcan_peripheral_t can)
Fetches all CAN errors.
Definition bxcan.c:342
void bxcan_tx_frame(const bxcan_peripheral_t can, struct bxCANFrame *frame)
Transmits the specified CAN frame.
Definition bxcan.c:264
bxcan_peripheral
Available bxCAN operation modes.
Definition bxcan.h:170
void bxcan_set_current_mode(const bxcan_peripheral_t can, const bxcan_mode_t mode)
Sets the bxCAN to the specified mode.
Definition bxcan.c:24
void bxcan_configure_automation(const bxcan_peripheral_t can, const struct bxCANAutomationConfig config)
Configures the bxCAN automation according to config.
Definition bxcan.c:140
void bxcan_set_time_triggered_mode(const bxcan_peripheral_t can, const _Bool state)
Sets bxCAN time triggered communication.
Definition bxcan.c:79
void bxcan_rx_frame_fetch(const bxcan_peripheral_t can, const _Bool FIFO, struct bxCANMailboxRegs *buffer)
Fetches received CAN frame data.
Definition bxcan.c:305
enum bxcan_test_mode bxcan_test_mode_t
Available bxCAN test modes.
enum bxcan_peripheral bxcan_peripheral_t
Available bxCAN operation modes.
void bxcan_rx_frame_process(const struct bxCANMailboxRegs buffer, struct bxCANFrame *frame)
Extracts received CAN frame data.
Definition bxcan.c:323
void bxcan_set_interrupts(const bxcan_peripheral_t can, const struct bxCANISR config)
Enables the specified bxCAN interrupts.
Definition bxcan.c:95
Defines used commonly in most files.
CMSIS device header stubs.
Contains bxCAN baudrate configuration.
Definition bxcan.h:100
uint8_t TimeSeg2
Definition bxcan.h:102
uint8_t TimeSeg1
Definition bxcan.h:101
uint16_t BaudPrescaler
Definition bxcan.h:103
Contains bxCAN error info.
Definition bxcan.h:154
Contains bxCAN filter configuration.
Definition bxcan.h:112
Contains bxCAN Filter registers.
Definition bxcan.h:37
Contains bxCAN frame structure.
Definition bxcan.h:133
_Bool TME
Definition bxcan.h:78
_Bool FOV0
Definition bxcan.h:81
_Bool FMP1
Definition bxcan.h:82
_Bool SLK
Definition bxcan.h:91
_Bool LEC
Definition bxcan.h:88
_Bool BOF
Definition bxcan.h:87
_Bool FOV1
Definition bxcan.h:84
_Bool EPV
Definition bxcan.h:86
_Bool FF0
Definition bxcan.h:80
_Bool FF1
Definition bxcan.h:83
_Bool EWG
Definition bxcan.h:85
_Bool FMP0
Definition bxcan.h:79
_Bool WKU
Definition bxcan.h:90
_Bool ERR
Definition bxcan.h:89
Contains bxCAN Mailbox registers.
Definition bxcan.h:24
REG32 LR
Definition bxcan.h:27
REG32 IR
Definition bxcan.h:25
REG32 TR
Definition bxcan.h:26
REG32 HR
Definition bxcan.h:28
Contains bxCAN registers.
Definition bxcan.h:48