nrfxlib API 3.3.99
Loading...
Searching...
No Matches
nrf_can.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NRF_CAN_H__
8#define NRF_CAN_H__
9
10#include <nrfx.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define SOFTPERIPHERAL_CAN (1)
17#if SOFTPERIPHERAL_CAN
18#include <nrf_sp_can.h>
19#define NRF_CAN_Type NRF_SP_CAN_Type
20#else
21#define NRF_CAN_Type NRF_CAN_Type
22#endif
23
31typedef enum
32{
33 NRF_CAN_TASK_START = offsetof(NRF_CAN_Type, TASKS_START),
35 TASKS_RESET),
37
39typedef enum
40{
41 NRF_CAN_EVENT_TXCOMPLETE = offsetof(NRF_CAN_Type, EVENTS_TXCOMPLETE),
42 NRF_CAN_EVENT_RXCOMPLETE = offsetof(NRF_CAN_Type, EVENTS_RXCOMPLETE),
43 NRF_CAN_EVENT_ERRORDETECTED = offsetof(NRF_CAN_Type, EVENTS_ERRORDETECTED),
44 NRF_CAN_EVENT_STATECHANGED = offsetof(NRF_CAN_Type, EVENTS_STATECHANGED),
46
55
62
70
79
88
96
97typedef struct
98{
99 uint32_t filter;
100 uint32_t id_mask;
102
104typedef struct
105{
106 uint32_t identifier;
107 uint8_t length;
108 uint8_t data[8];
109 uint16_t crc;
113
114NRF_STATIC_INLINE void nrf_can_task_trigger(NRF_CAN_Type * p_reg, nrf_can_task_t task);
115
116NRF_STATIC_INLINE void nrf_can_task_untrigger(NRF_CAN_Type * p_reg, nrf_can_task_t task);
117
118NRF_STATIC_INLINE void nrf_can_enable(NRF_CAN_Type * p_reg);
119
120NRF_STATIC_INLINE void nrf_can_disable(NRF_CAN_Type * p_reg);
121
122NRF_STATIC_INLINE bool nrf_can_enable_check(NRF_CAN_Type const * p_reg);
123
124NRF_STATIC_INLINE void nrf_can_event_clear(NRF_CAN_Type * p_reg, nrf_can_event_t event);
125
126NRF_STATIC_INLINE bool nrf_can_event_check(NRF_CAN_Type const * p_reg, nrf_can_event_t event);
127
128NRF_STATIC_INLINE uint32_t nrf_can_event_address_get(NRF_CAN_Type const * p_reg,
129 nrf_can_event_t event);
130
131NRF_STATIC_INLINE void nrf_can_int_enable(NRF_CAN_Type * p_reg, uint32_t mask);
132
133NRF_STATIC_INLINE uint32_t nrf_can_int_enable_check(NRF_CAN_Type const * p_reg, uint32_t mask);
134
135NRF_STATIC_INLINE void nrf_can_int_disable(NRF_CAN_Type * p_reg, uint32_t mask);
136
137NRF_STATIC_INLINE void nrf_can_rxfilter_set(NRF_CAN_Type * p_reg,
138 nrf_can_rxfilter_t const * p_rxfilter,
139 uint8_t index);
140
141NRF_STATIC_INLINE void nrf_can_rxfilter_get(NRF_CAN_Type const * p_reg,
142 nrf_can_rxfilter_t * p_rxfilter,
143 uint8_t index);
144
145NRF_STATIC_INLINE void nrf_can_rxfilter_usefilter_set(NRF_CAN_Type * p_reg,
146 uint8_t index,
147 uint8_t value);
148
149NRF_STATIC_INLINE bool nrf_can_rxfilter_usefilter_get(NRF_CAN_Type const * p_reg, uint8_t index);
150
151NRF_STATIC_INLINE void nrf_can_rxfilter_filtermatched_set(NRF_CAN_Type * p_reg,
152 uint8_t index,
153 uint8_t value);
154
155NRF_STATIC_INLINE bool nrf_can_rxfilter_filtermatched_get(NRF_CAN_Type const * p_reg,
156 uint8_t index);
157
158NRF_STATIC_INLINE void nrf_can_rxfilter_inmailbox_set(NRF_CAN_Type * p_reg,
159 uint8_t index,
160 uint8_t value);
161
162NRF_STATIC_INLINE bool nrf_can_rxfilter_inmailbox_get(NRF_CAN_Type const * p_reg, uint8_t index);
163
164NRF_STATIC_INLINE void nrf_can_set_parsing_timing(NRF_CAN_Type * p_reg);
165
166NRF_STATIC_INLINE void nrf_can_set_parsing_mode(NRF_CAN_Type * p_reg);
167
168NRF_STATIC_INLINE void nrf_can_set_parsing_rxfilter(NRF_CAN_Type * p_reg);
169
170NRF_STATIC_INLINE void nrf_can_config_set(NRF_CAN_Type * p_reg, nrf_can_config_t const * p_config);
171
172NRF_STATIC_INLINE void nrf_can_config_get(NRF_CAN_Type const * p_reg, nrf_can_config_t * p_config);
173
174NRF_STATIC_INLINE void nrf_can_txframe_set(NRF_CAN_Type * p_reg,
175 uint8_t idx,
176 nrf_can_frame_t const * p_frame);
177
178NRF_STATIC_INLINE void nrf_can_txframe_get(NRF_CAN_Type const * p_reg,
179 uint8_t idx,
180 nrf_can_frame_t * p_frame);
181
182NRF_STATIC_INLINE void nrf_can_rxframe_set(NRF_CAN_Type * p_reg,
183 uint8_t idx,
184 nrf_can_frame_t const * p_frame);
185
186NRF_STATIC_INLINE void nrf_can_rxframe_get(NRF_CAN_Type const * p_reg,
187 uint8_t idx,
188 nrf_can_frame_t * p_frame);
189
190NRF_STATIC_INLINE nrf_can_state_t nrf_can_state_get(NRF_CAN_Type const * p_reg);
191
192NRF_STATIC_INLINE uint32_t nrf_can_error_get(NRF_CAN_Type const * p_reg);
193
194NRF_STATIC_INLINE bool nrf_can_status_error_check(uint32_t error_mask);
195
196NRF_STATIC_INLINE void nrf_can_handshake_set(NRF_CAN_Type * p_reg, uint32_t val, uint8_t idx);
197
198NRF_STATIC_INLINE uint32_t nrf_can_handshake_get(NRF_CAN_Type const * p_reg, uint8_t idx);
199
200#ifndef NRF_DECLARE_ONLY
201
202NRF_STATIC_INLINE void nrf_can_task_trigger(NRF_CAN_Type * p_reg, nrf_can_task_t task)
203{
204 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
205}
206
207NRF_STATIC_INLINE void nrf_can_task_untrigger(NRF_CAN_Type * p_reg, nrf_can_task_t task)
208{
209 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x0UL;
210}
211
212NRF_STATIC_INLINE void nrf_can_enable(NRF_CAN_Type * p_reg)
213{
214 p_reg->ENABLE = SP_CAN_ENABLE_ENABLE_Enabled;
215}
216
217NRF_STATIC_INLINE void nrf_can_disable(NRF_CAN_Type * p_reg)
218{
219 p_reg->ENABLE = SP_CAN_ENABLE_ENABLE_Disabled;
220}
221
222NRF_STATIC_INLINE bool nrf_can_enable_check(NRF_CAN_Type const * p_reg)
223{
224 return (bool)(p_reg->ENABLE & SP_CAN_ENABLE_ENABLE_Msk);
225}
226
227NRF_STATIC_INLINE void nrf_can_event_clear(NRF_CAN_Type * p_reg, nrf_can_event_t event)
228{
229 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
230 nrf_event_readback((uint8_t *)p_reg + (uint32_t)event);
231}
232
233NRF_STATIC_INLINE bool nrf_can_event_check(NRF_CAN_Type const * p_reg, nrf_can_event_t event)
234{
235 return nrf_event_check(p_reg, event);
236}
237
238NRF_STATIC_INLINE uint32_t nrf_can_event_address_get(NRF_CAN_Type const * p_reg,
239 nrf_can_event_t event)
240{
241 return nrf_task_event_address_get(p_reg, event);
242}
243
244NRF_STATIC_INLINE void nrf_can_int_enable(NRF_CAN_Type * p_reg, uint32_t mask)
245{
246 p_reg->INTEN |= mask;
247}
248
249NRF_STATIC_INLINE uint32_t nrf_can_int_enable_check(NRF_CAN_Type const * p_reg, uint32_t mask)
250{
251 return p_reg->INTEN & mask;
252}
253
254NRF_STATIC_INLINE void nrf_can_int_disable(NRF_CAN_Type * p_reg, uint32_t mask)
255{
256 p_reg->INTEN &= ~mask;
257}
258
259NRF_STATIC_INLINE void nrf_can_rxfilter_set(NRF_CAN_Type * p_reg,
260 nrf_can_rxfilter_t const * p_rxfilter,
261 uint8_t index)
262{
263 p_reg->RXFILTER[index].IDFILTER = p_rxfilter->filter & SP_CAN_RXFILTER_IDFILTER_IDENTIFIER_Msk;
264 p_reg->RXFILTER[index].IDMASK = p_rxfilter->id_mask & SP_CAN_RXFILTER_IDMASK_MASK_Msk;
265}
266
267NRF_STATIC_INLINE void nrf_can_rxfilter_get(NRF_CAN_Type const * p_reg,
268 nrf_can_rxfilter_t * p_rxfilter,
269 uint8_t index)
270{
271 p_rxfilter->filter = p_reg->RXFILTER[index].IDFILTER & SP_CAN_RXFILTER_IDFILTER_IDENTIFIER_Msk;
272 p_rxfilter->id_mask = p_reg->RXFILTER[index].IDMASK & SP_CAN_RXFILTER_IDMASK_MASK_Msk;
273}
274
275NRF_STATIC_INLINE void nrf_can_rxfilter_usefilter_set(NRF_CAN_Type * p_reg,
276 uint8_t index,
277 uint8_t value)
278{
279 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
280 ~SP_CAN_RXFILTER_IDFILTER_USEFILTER_Msk) |
283}
284
285NRF_STATIC_INLINE bool nrf_can_rxfilter_usefilter_get(NRF_CAN_Type const * p_reg, uint8_t index)
286{
287 if ((p_reg->RXFILTER[index].IDFILTER & SP_CAN_RXFILTER_IDFILTER_USEFILTER_Msk)
289 {
290 return true;
291 }
292 return false;
293}
294
296 uint8_t index,
297 uint8_t value)
298{
299 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
300 ~SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Msk) |
303}
304
305NRF_STATIC_INLINE bool nrf_can_rxfilter_filtermatched_get(NRF_CAN_Type const * p_reg, uint8_t index)
306{
307 if ((p_reg->RXFILTER[index].IDFILTER & SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Msk)
309 {
310 return true;
311 }
312 return false;
313}
314
315NRF_STATIC_INLINE void nrf_can_rxfilter_inmailbox_set(NRF_CAN_Type * p_reg,
316 uint8_t index,
317 uint8_t value)
318{
319 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
320 ~SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Msk) |
323}
324
325NRF_STATIC_INLINE bool nrf_can_rxfilter_inmailbox_get(NRF_CAN_Type const * p_reg, uint8_t index)
326{
327 if ((p_reg->RXFILTER[index].IDFILTER & SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Msk)
329 {
330 return true;
331 }
332 return false;
333}
334
335NRF_STATIC_INLINE void nrf_can_set_parsing_timing(NRF_CAN_Type * p_reg)
336{
337 p_reg->CONFIG.PARSING = NRF_CAN_PARSING_TIMING;
338}
339
340NRF_STATIC_INLINE void nrf_can_set_parsing_mode(NRF_CAN_Type * p_reg)
341{
342 p_reg->CONFIG.PARSING = NRF_CAN_PARSING_MODE;
343}
344
345NRF_STATIC_INLINE void nrf_can_set_parsing_rxfilter(NRF_CAN_Type * p_reg)
346{
347 p_reg->CONFIG.PARSING = NRF_CAN_PARSING_RXFILTER;
348}
349
350NRF_STATIC_INLINE void nrf_can_config_set(NRF_CAN_Type * p_reg, nrf_can_config_t const * p_config)
351{
352 p_reg->CONFIG.TIMING = p_config->timing;
353 p_reg->CONFIG.REQUEST = ((uint32_t)p_config->request) &
355 p_reg->CONFIG.MODE = (((uint32_t)p_config->mode) &
357}
358
359NRF_STATIC_INLINE void nrf_can_config_get(NRF_CAN_Type const * p_reg, nrf_can_config_t * p_config)
360{
361 p_config->timing = p_reg->CONFIG.TIMING;
362 p_config->request = (nrf_can_request_t)(p_reg->CONFIG.REQUEST &
364 p_config->mode = (nrf_can_mode_t)(p_reg->CONFIG.MODE &
366}
367
368NRF_STATIC_INLINE void nrf_can_txframe_set(NRF_CAN_Type * p_reg,
369 uint8_t idx,
370 nrf_can_frame_t const * p_frame)
371{
372 p_reg->TXFRAME[idx].IDENTIFIER = (p_frame->identifier
375
376 p_reg->TXFRAME[idx].TXDATAL = ((uint32_t)p_frame->data[0] << 0) | ((uint32_t)p_frame->data[1]
377 << 8) |
378 ((uint32_t)p_frame->data[2]
379 << 16) | ((uint32_t)p_frame->data[3] << 24);
380
381 p_reg->TXFRAME[idx].TXDATAH = ((uint32_t)p_frame->data[4] << 0) | ((uint32_t)p_frame->data[5]
382 << 8) |
383 ((uint32_t)p_frame->data[6]
384 << 16) | ((uint32_t)p_frame->data[7] << 24);
385
386 p_reg->TXFRAME[idx].METADATA = (((uint32_t)p_frame->extended_format
389 (((uint32_t)p_frame->remote_request
392 (((uint32_t)p_frame->length
395 (((uint32_t)p_frame->crc << SP_CAN_TXFRAME_METADATA_CRC_Pos) &
397}
398
399NRF_STATIC_INLINE void nrf_can_txframe_get(NRF_CAN_Type const * p_reg,
400 uint8_t idx,
401 nrf_can_frame_t * p_frame)
402{
403 uint32_t identifier = p_reg->TXFRAME[idx].IDENTIFIER;
404
407
408 uint32_t datal = p_reg->TXFRAME[idx].TXDATAL;
409 p_frame->data[0] = (uint8_t)(datal >> 0);
410 p_frame->data[1] = (uint8_t)(datal >> 8);
411 p_frame->data[2] = (uint8_t)(datal >> 16);
412 p_frame->data[3] = (uint8_t)(datal >> 24);
413
414 uint32_t datah = p_reg->TXFRAME[idx].TXDATAH;
415 p_frame->data[4] = (uint8_t)(datah >> 0);
416 p_frame->data[5] = (uint8_t)(datah >> 8);
417 p_frame->data[6] = (uint8_t)(datah >> 16);
418 p_frame->data[7] = (uint8_t)(datah >> 24);
419
420 uint32_t metadata = p_reg->TXFRAME[idx].METADATA;
423 p_frame->remote_request = (bool)((metadata & SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Msk)
425 p_frame->length = (uint8_t)((metadata & SP_CAN_TXFRAME_METADATA_DATALENGTH_Msk)
427 p_frame->crc = (uint16_t)((metadata & SP_CAN_TXFRAME_METADATA_CRC_Msk)
429}
430
431NRF_STATIC_INLINE void nrf_can_rxframe_set(NRF_CAN_Type * p_reg,
432 uint8_t idx,
433 nrf_can_frame_t const * p_frame)
434{
435 p_reg->RXFRAME[idx].IDENTIFIER = (p_frame->identifier
438
439 p_reg->RXFRAME[idx].RXDATAL = ((uint32_t)p_frame->data[0] << 0) | ((uint32_t)p_frame->data[1]
440 << 8) |
441 ((uint32_t)p_frame->data[2]
442 << 16) | ((uint32_t)p_frame->data[3] << 24);
443
444 p_reg->RXFRAME[idx].RXDATAH = ((uint32_t)p_frame->data[4] << 0) | ((uint32_t)p_frame->data[5]
445 << 8) |
446 ((uint32_t)p_frame->data[6]
447 << 16) | ((uint32_t)p_frame->data[7] << 24);
448
449 p_reg->RXFRAME[idx].METADATA = (((uint32_t)p_frame->extended_format
452 (((uint32_t)p_frame->remote_request
455 (((uint32_t)p_frame->length
458 (((uint32_t)p_frame->crc << SP_CAN_RXFRAME_METADATA_CRC_Pos) &
460}
461
462NRF_STATIC_INLINE void nrf_can_rxframe_get(NRF_CAN_Type const * p_reg,
463 uint8_t idx,
464 nrf_can_frame_t * p_frame)
465{
466 uint32_t identifier = p_reg->RXFRAME[idx].IDENTIFIER;
467
470
471 uint32_t datal = p_reg->RXFRAME[idx].RXDATAL;
472 p_frame->data[0] = (uint8_t)(datal >> 0);
473 p_frame->data[1] = (uint8_t)(datal >> 8);
474 p_frame->data[2] = (uint8_t)(datal >> 16);
475 p_frame->data[3] = (uint8_t)(datal >> 24);
476
477 uint32_t datah = p_reg->RXFRAME[idx].RXDATAH;
478 p_frame->data[4] = (uint8_t)(datah >> 0);
479 p_frame->data[5] = (uint8_t)(datah >> 8);
480 p_frame->data[6] = (uint8_t)(datah >> 16);
481 p_frame->data[7] = (uint8_t)(datah >> 24);
482
483 uint32_t metadata = p_reg->RXFRAME[idx].METADATA;
486 p_frame->remote_request = (bool)((metadata & SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Msk)
488 p_frame->length = (uint8_t)((metadata & SP_CAN_RXFRAME_METADATA_DATALENGTH_Msk)
490 p_frame->crc = (uint16_t)((metadata & SP_CAN_RXFRAME_METADATA_CRC_Msk)
492}
493
494NRF_STATIC_INLINE nrf_can_state_t nrf_can_state_get(NRF_CAN_Type const * p_reg)
495{
496 return (p_reg->STATUS.STATUS & SP_CAN_STATUS_STATUS_STATE_Msk)
498}
499
500NRF_STATIC_INLINE uint32_t nrf_can_error_get(NRF_CAN_Type const * p_reg)
501{
502 return (p_reg->STATUS.STATUS & 0x1FF);
503}
504
513
514NRF_STATIC_INLINE void nrf_can_handshake_set(NRF_CAN_Type * p_reg, uint32_t val, uint8_t idx)
515{
516 p_reg->SPSYNC.AUX[idx] = val;
517}
518
519NRF_STATIC_INLINE uint32_t nrf_can_handshake_get(NRF_CAN_Type const * p_reg, uint8_t idx)
520{
521 return p_reg->SPSYNC.AUX[idx];
522}
523
524#endif // NRF_DECLARE_ONLY
525
528#ifdef __cplusplus
529}
530#endif
531
532#endif // NRF_CAN_H__
NRF_STATIC_INLINE void nrf_can_txframe_get(NRF_SP_CAN_Type const *p_reg, uint8_t idx, nrf_can_frame_t *p_frame)
Definition nrf_can.h:399
NRF_STATIC_INLINE void nrf_can_config_set(NRF_SP_CAN_Type *p_reg, nrf_can_config_t const *p_config)
Definition nrf_can.h:350
NRF_STATIC_INLINE uint32_t nrf_can_int_enable_check(NRF_SP_CAN_Type const *p_reg, uint32_t mask)
Definition nrf_can.h:249
NRF_STATIC_INLINE void nrf_can_rxfilter_get(NRF_SP_CAN_Type const *p_reg, nrf_can_rxfilter_t *p_rxfilter, uint8_t index)
Definition nrf_can.h:267
NRF_STATIC_INLINE void nrf_can_int_enable(NRF_SP_CAN_Type *p_reg, uint32_t mask)
Definition nrf_can.h:244
NRF_STATIC_INLINE uint32_t nrf_can_event_address_get(NRF_SP_CAN_Type const *p_reg, nrf_can_event_t event)
Definition nrf_can.h:238
nrf_can_task_t
CAN tasks.
Definition nrf_can.h:32
@ NRF_CAN_TASK_START
Definition nrf_can.h:33
@ NRF_CAN_TASK_RESET
Definition nrf_can.h:34
NRF_STATIC_INLINE void nrf_can_rxfilter_inmailbox_set(NRF_SP_CAN_Type *p_reg, uint8_t index, uint8_t value)
Definition nrf_can.h:315
NRF_STATIC_INLINE void nrf_can_task_trigger(NRF_SP_CAN_Type *p_reg, nrf_can_task_t task)
Definition nrf_can.h:202
NRF_STATIC_INLINE void nrf_can_rxframe_set(NRF_SP_CAN_Type *p_reg, uint8_t idx, nrf_can_frame_t const *p_frame)
Definition nrf_can.h:431
NRF_STATIC_INLINE void nrf_can_config_get(NRF_SP_CAN_Type const *p_reg, nrf_can_config_t *p_config)
Definition nrf_can.h:359
NRF_STATIC_INLINE nrf_can_state_t nrf_can_state_get(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:494
nrf_can_state_t
Definition nrf_can.h:81
@ NRF_CAN_STATE_ERRORACTIVE
Definition nrf_can.h:82
@ NRF_CAN_STATE_ERRORPASSIVE
Definition nrf_can.h:84
@ NRF_CAN_STATE_BUSOFF
Definition nrf_can.h:85
@ NRF_CAN_STATE_ERRORWARNING
Definition nrf_can.h:83
@ NRF_CAN_STATE_STOPPED
Definition nrf_can.h:86
NRF_STATIC_INLINE void nrf_can_enable(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:212
NRF_STATIC_INLINE void nrf_can_disable(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:217
NRF_STATIC_INLINE void nrf_can_txframe_set(NRF_SP_CAN_Type *p_reg, uint8_t idx, nrf_can_frame_t const *p_frame)
Definition nrf_can.h:368
NRF_STATIC_INLINE void nrf_can_rxframe_get(NRF_SP_CAN_Type const *p_reg, uint8_t idx, nrf_can_frame_t *p_frame)
Definition nrf_can.h:462
NRF_STATIC_INLINE bool nrf_can_rxfilter_filtermatched_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:305
NRF_STATIC_INLINE void nrf_can_task_untrigger(NRF_SP_CAN_Type *p_reg, nrf_can_task_t task)
Definition nrf_can.h:207
NRF_STATIC_INLINE bool nrf_can_enable_check(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:222
NRF_STATIC_INLINE void nrf_can_rxfilter_filtermatched_set(NRF_SP_CAN_Type *p_reg, uint8_t index, uint8_t value)
Definition nrf_can.h:295
NRF_STATIC_INLINE void nrf_can_set_parsing_timing(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:335
nrf_can_event_t
CAN events.
Definition nrf_can.h:40
@ NRF_CAN_EVENT_TXCOMPLETE
Definition nrf_can.h:41
@ NRF_CAN_EVENT_RXCOMPLETE
Definition nrf_can.h:42
@ NRF_CAN_EVENT_STATECHANGED
Definition nrf_can.h:44
@ NRF_CAN_EVENT_ERRORDETECTED
Definition nrf_can.h:43
nrf_can_int_mask_t
CAN interrupt masks.
Definition nrf_can.h:49
@ NRF_CAN_INT_ERRORDETECTED_MASK
Definition nrf_can.h:52
@ NRF_CAN_INT_STATECHANGED_MASK
Definition nrf_can.h:53
@ NRF_CAN_INT_TXCOMPLETE_MASK
Definition nrf_can.h:50
@ NRF_CAN_INT_RXCOMPLETE_MASK
Definition nrf_can.h:51
NRF_STATIC_INLINE void nrf_can_set_parsing_rxfilter(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:345
NRF_STATIC_INLINE bool nrf_can_rxfilter_usefilter_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:285
nrf_can_mode_t
CAN operation modes.
Definition nrf_can.h:73
@ NRF_CAN_MODE_LOOPBACK
Definition nrf_can.h:75
@ NRF_CAN_MODE_LISTENONLY
Definition nrf_can.h:76
@ NRF_CAN_MODE_ONESHOT
Definition nrf_can.h:77
@ NRF_CAN_MODE_NORMAL
Definition nrf_can.h:74
NRF_STATIC_INLINE uint32_t nrf_can_handshake_get(NRF_SP_CAN_Type const *p_reg, uint8_t idx)
Definition nrf_can.h:519
NRF_STATIC_INLINE void nrf_can_handshake_set(NRF_SP_CAN_Type *p_reg, uint32_t val, uint8_t idx)
Definition nrf_can.h:514
NRF_STATIC_INLINE bool nrf_can_rxfilter_inmailbox_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:325
NRF_STATIC_INLINE void nrf_can_set_parsing_mode(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:340
nrf_can_request_t
CAN request types.
Definition nrf_can.h:58
@ NRF_CAN_REQUEST_TX
Definition nrf_can.h:60
@ NRF_CAN_REQUEST_RX
Definition nrf_can.h:59
nrf_can_parsing_t
Definition nrf_can.h:64
@ NRF_CAN_PARSING_MODE
Definition nrf_can.h:67
@ NRF_CAN_PARSING_NONE
Definition nrf_can.h:65
@ NRF_CAN_PARSING_TIMING
Definition nrf_can.h:66
@ NRF_CAN_PARSING_RXFILTER
Definition nrf_can.h:68
NRF_STATIC_INLINE void nrf_can_rxfilter_set(NRF_SP_CAN_Type *p_reg, nrf_can_rxfilter_t const *p_rxfilter, uint8_t index)
Definition nrf_can.h:259
NRF_STATIC_INLINE bool nrf_can_event_check(NRF_SP_CAN_Type const *p_reg, nrf_can_event_t event)
Definition nrf_can.h:233
NRF_STATIC_INLINE uint32_t nrf_can_error_get(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:500
NRF_STATIC_INLINE void nrf_can_rxfilter_usefilter_set(NRF_SP_CAN_Type *p_reg, uint8_t index, uint8_t value)
Definition nrf_can.h:275
NRF_STATIC_INLINE void nrf_can_int_disable(NRF_SP_CAN_Type *p_reg, uint32_t mask)
Definition nrf_can.h:254
NRF_STATIC_INLINE bool nrf_can_status_error_check(uint32_t error_mask)
Definition nrf_can.h:505
NRF_STATIC_INLINE void nrf_can_event_clear(NRF_SP_CAN_Type *p_reg, nrf_can_event_t event)
Definition nrf_can.h:227
#define NRF_CAN_Type
Definition nrf_can.h:19
#define SP_CAN_INTEN_RXCOMPLETE_Msk
Definition nrf_sp_can.h:665
#define SP_CAN_CONFIG_MODE_MODE_Msk
Definition nrf_sp_can.h:85
#define SP_CAN_CONFIG_MODE_MODE_Loopback
Definition nrf_sp_can.h:89
#define SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Msk
Definition nrf_sp_can.h:235
#define SP_CAN_STATUS_STATUS_FORMERROR_Msk
Definition nrf_sp_can.h:377
#define SP_CAN_STATUS_STATUS_STATE_ERRORPASSIVE
Definition nrf_sp_can.h:421
#define SP_CAN_STATUS_STATUS_STATE_ERRORACTIVE
Definition nrf_sp_can.h:419
#define SP_CAN_CONFIG_PARSING_REGGROUP_Timing
Definition nrf_sp_can.h:43
#define SP_CAN_CONFIG_REQUEST_REQUEST_TX
Definition nrf_sp_can.h:78
#define SP_CAN_RXFRAME_METADATA_DATALENGTH_Pos
Definition nrf_sp_can.h:342
#define SP_CAN_CONFIG_MODE_MODE_ListenOnly
Definition nrf_sp_can.h:90
#define SP_CAN_INTEN_TXCOMPLETE_Msk
Definition nrf_sp_can.h:657
#define SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Msk
Definition nrf_sp_can.h:129
#define SP_CAN_TXFRAME_METADATA_DATALENGTH_Msk
Definition nrf_sp_can.h:246
#define SP_CAN_ENABLE_ENABLE_Msk
Definition nrf_sp_can.h:692
#define SP_CAN_RXFRAME_IDENTIFIER_IDENTIFIER_Pos
Definition nrf_sp_can.h:272
#define SP_CAN_RXFILTER_IDFILTER_USEFILTER_Pos
Definition nrf_sp_can.h:117
#define SP_CAN_CONFIG_PARSING_REGGROUP_OperationMode
Definition nrf_sp_can.h:44
#define SP_CAN_RXFRAME_IDENTIFIER_IDENTIFIER_Msk
Definition nrf_sp_can.h:273
#define SP_CAN_STATUS_STATUS_STATE_Msk
Definition nrf_sp_can.h:416
#define SP_CAN_RXFILTER_IDFILTER_IDENTIFIER_Msk
Definition nrf_sp_can.h:111
#define SP_CAN_RXFRAME_METADATA_CRC_Pos
Definition nrf_sp_can.h:347
#define SP_CAN_RXFILTER_IDMASK_MASK_Msk
Definition nrf_sp_can.h:154
#define SP_CAN_CONFIG_PARSING_REGGROUP_None
Definition nrf_sp_can.h:42
#define SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Pos
Definition nrf_sp_can.h:128
#define SP_CAN_STATUS_STATUS_BITERROR_Msk
Definition nrf_sp_can.h:366
#define SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Pos
Definition nrf_sp_can.h:139
#define SP_CAN_INTEN_STATECHANGED_Msk
Definition nrf_sp_can.h:681
#define SP_CAN_STATUS_STATUS_ACKERROR_Msk
Definition nrf_sp_can.h:381
#define SP_CAN_TXFRAME_METADATA_EXTENDEDFORMAT_Msk
Definition nrf_sp_can.h:224
#define SP_CAN_TXFRAME_IDENTIFIER_IDENTIFIER_Pos
Definition nrf_sp_can.h:175
#define SP_CAN_STATUS_STATUS_CRCERROR_Msk
Definition nrf_sp_can.h:385
#define SP_CAN_TXFRAME_METADATA_EXTENDEDFORMAT_Pos
Definition nrf_sp_can.h:223
#define SP_CAN_RXFRAME_METADATA_EXTENDEDFORMAT_Msk
Definition nrf_sp_can.h:321
#define SP_CAN_CONFIG_MODE_MODE_OneShot
Definition nrf_sp_can.h:91
#define SP_CAN_RXFILTER_IDFILTER_USEFILTER_Msk
Definition nrf_sp_can.h:118
#define SP_CAN_STATUS_STATUS_STATE_BUSOFF
Definition nrf_sp_can.h:422
#define SP_CAN_TXFRAME_IDENTIFIER_IDENTIFIER_Msk
Definition nrf_sp_can.h:176
#define SP_CAN_TXFRAME_METADATA_CRC_Pos
Definition nrf_sp_can.h:250
#define SP_CAN_CONFIG_REQUEST_REQUEST_RX
Definition nrf_sp_can.h:77
#define SP_CAN_CONFIG_PARSING_REGGROUP_RxFilters
Definition nrf_sp_can.h:45
#define SP_CAN_INTEN_ERRORDETECTED_Msk
Definition nrf_sp_can.h:673
#define SP_CAN_CONFIG_REQUEST_REQUEST_Msk
Definition nrf_sp_can.h:74
#define SP_CAN_ENABLE_ENABLE_Disabled
Definition nrf_sp_can.h:695
#define SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Msk
Definition nrf_sp_can.h:140
#define SP_CAN_RXFRAME_METADATA_DATALENGTH_Msk
Definition nrf_sp_can.h:343
#define SP_CAN_STATUS_STATUS_PROTOCOLERROR_Msk
Definition nrf_sp_can.h:397
#define SP_CAN_STATUS_STATUS_STATE_Pos
Definition nrf_sp_can.h:415
#define SP_CAN_RXFRAME_METADATA_CRC_Msk
Definition nrf_sp_can.h:348
#define SP_CAN_TXFRAME_METADATA_CRC_Msk
Definition nrf_sp_can.h:251
#define SP_CAN_RXFRAME_METADATA_EXTENDEDFORMAT_Pos
Definition nrf_sp_can.h:320
#define SP_CAN_STATUS_STATUS_STATE_STOPPED
Definition nrf_sp_can.h:423
#define SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Msk
Definition nrf_sp_can.h:332
#define SP_CAN_ENABLE_ENABLE_Enabled
Definition nrf_sp_can.h:696
#define SP_CAN_TXFRAME_METADATA_DATALENGTH_Pos
Definition nrf_sp_can.h:245
#define SP_CAN_CONFIG_MODE_MODE_Normal
Definition nrf_sp_can.h:88
#define SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Pos
Definition nrf_sp_can.h:234
#define SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Pos
Definition nrf_sp_can.h:331
#define SP_CAN_STATUS_STATUS_STATE_ERRORWARNING
Definition nrf_sp_can.h:420
#define SP_CAN_STATUS_STATUS_BITSTUFFINGERROR_Msk
Definition nrf_sp_can.h:370
nrf_can_request_t request
Definition nrf_can.h:93
nrf_can_mode_t mode
Definition nrf_can.h:94
uint32_t timing
Definition nrf_can.h:92
CAN configuration structure.
Definition nrf_can.h:91
bool remote_request
Definition nrf_can.h:111
bool extended_format
Definition nrf_can.h:110
uint16_t crc
Definition nrf_can.h:109
uint8_t data[8]
Definition nrf_can.h:108
uint8_t length
Definition nrf_can.h:107
uint32_t identifier
Definition nrf_can.h:106
CAN frame structure.
Definition nrf_can.h:105
uint32_t id_mask
Definition nrf_can.h:100
uint32_t filter
Definition nrf_can.h:99
Definition nrf_can.h:98