nrfxlib API 3.4.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
29
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
71
80
89
97
98typedef struct
99{
100 uint32_t filter;
101 uint32_t id_mask;
102 uint32_t filterwidth;
104
106typedef struct
107{
108 uint32_t identifier;
109 uint8_t length;
110 uint8_t data[8];
111 uint16_t crc;
115
116NRF_STATIC_INLINE void nrf_can_task_trigger(NRF_CAN_Type * p_reg, nrf_can_task_t task);
117
118NRF_STATIC_INLINE void nrf_can_task_untrigger(NRF_CAN_Type * p_reg, nrf_can_task_t task);
119
120NRF_STATIC_INLINE void nrf_can_enable(NRF_CAN_Type * p_reg);
121
122NRF_STATIC_INLINE void nrf_can_disable(NRF_CAN_Type * p_reg);
123
124NRF_STATIC_INLINE bool nrf_can_enable_check(NRF_CAN_Type const * p_reg);
125
126NRF_STATIC_INLINE void nrf_can_event_clear(NRF_CAN_Type * p_reg, nrf_can_event_t event);
127
128NRF_STATIC_INLINE bool nrf_can_event_check(NRF_CAN_Type const * p_reg, nrf_can_event_t event);
129
130NRF_STATIC_INLINE uint32_t nrf_can_event_address_get(NRF_CAN_Type const * p_reg,
131 nrf_can_event_t event);
132
133NRF_STATIC_INLINE void nrf_can_int_enable(NRF_CAN_Type * p_reg, uint32_t mask);
134
135NRF_STATIC_INLINE uint32_t nrf_can_int_enable_check(NRF_CAN_Type const * p_reg, uint32_t mask);
136
137NRF_STATIC_INLINE void nrf_can_int_disable(NRF_CAN_Type * p_reg, uint32_t mask);
138
139NRF_STATIC_INLINE void nrf_can_rxfilter_set(NRF_CAN_Type * p_reg,
140 nrf_can_rxfilter_t const * p_rxfilter,
141 uint8_t index);
142
143NRF_STATIC_INLINE void nrf_can_rxfilter_get(NRF_CAN_Type const * p_reg,
144 nrf_can_rxfilter_t * p_rxfilter,
145 uint8_t index);
146
147NRF_STATIC_INLINE void nrf_can_rxfilter_usefilter_set(NRF_CAN_Type * p_reg,
148 uint8_t index,
149 uint8_t value);
150
151NRF_STATIC_INLINE bool nrf_can_rxfilter_usefilter_get(NRF_CAN_Type const * p_reg, uint8_t index);
152
153NRF_STATIC_INLINE void nrf_can_rxfilter_filtermatched_set(NRF_CAN_Type * p_reg,
154 uint8_t index,
155 uint8_t value);
156
157NRF_STATIC_INLINE bool nrf_can_rxfilter_filtermatched_get(NRF_CAN_Type const * p_reg,
158 uint8_t index);
159
160NRF_STATIC_INLINE void nrf_can_rxfilter_inmailbox_set(NRF_CAN_Type * p_reg,
161 uint8_t index,
162 uint8_t value);
163
164NRF_STATIC_INLINE bool nrf_can_rxfilter_inmailbox_get(NRF_CAN_Type const * p_reg, uint8_t index);
165
166NRF_STATIC_INLINE void nrf_can_rxfilter_filterwidth_set(NRF_CAN_Type * p_reg,
167 uint8_t index,
168 uint8_t value);
169
170NRF_STATIC_INLINE uint8_t nrf_can_rxfilter_filterwidth_get(NRF_CAN_Type const * p_reg,
171 uint8_t index);
172
173NRF_STATIC_INLINE void nrf_can_set_parsing_timing(NRF_CAN_Type * p_reg);
174
175NRF_STATIC_INLINE void nrf_can_set_parsing_mode(NRF_CAN_Type * p_reg);
176
177NRF_STATIC_INLINE void nrf_can_set_parsing_rxfilter(NRF_CAN_Type * p_reg);
178
179NRF_STATIC_INLINE void nrf_can_set_parsing_dppi(NRF_CAN_Type * p_reg);
180
181NRF_STATIC_INLINE void nrf_can_config_set(NRF_CAN_Type * p_reg, nrf_can_config_t const * p_config);
182
183NRF_STATIC_INLINE void nrf_can_config_get(NRF_CAN_Type const * p_reg, nrf_can_config_t * p_config);
184
185NRF_STATIC_INLINE void nrf_can_txframe_set(NRF_CAN_Type * p_reg,
186 uint8_t idx,
187 nrf_can_frame_t const * p_frame);
188
189NRF_STATIC_INLINE void nrf_can_txframe_get(NRF_CAN_Type const * p_reg,
190 uint8_t idx,
191 nrf_can_frame_t * p_frame);
192
193NRF_STATIC_INLINE void nrf_can_rxframe_set(NRF_CAN_Type * p_reg,
194 uint8_t idx,
195 nrf_can_frame_t const * p_frame);
196
197NRF_STATIC_INLINE void nrf_can_rxframe_get(NRF_CAN_Type const * p_reg,
198 uint8_t idx,
199 nrf_can_frame_t * p_frame);
200
201NRF_STATIC_INLINE nrf_can_state_t nrf_can_state_get(NRF_CAN_Type const * p_reg);
202
203NRF_STATIC_INLINE uint32_t nrf_can_error_get(NRF_CAN_Type const * p_reg);
204
205NRF_STATIC_INLINE bool nrf_can_status_error_check(uint32_t error_mask);
206
207NRF_STATIC_INLINE void nrf_can_handshake_set(NRF_CAN_Type * p_reg, uint32_t val, uint8_t idx);
208
209NRF_STATIC_INLINE uint32_t nrf_can_handshake_get(NRF_CAN_Type const * p_reg, uint8_t idx);
210
211#ifndef NRF_DECLARE_ONLY
212
213NRF_STATIC_INLINE void nrf_can_task_trigger(NRF_CAN_Type * p_reg, nrf_can_task_t task)
214{
215 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
216}
217
218NRF_STATIC_INLINE void nrf_can_task_untrigger(NRF_CAN_Type * p_reg, nrf_can_task_t task)
219{
220 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x0UL;
221}
222
223NRF_STATIC_INLINE void nrf_can_enable(NRF_CAN_Type * p_reg)
224{
225 p_reg->ENABLE = SP_CAN_ENABLE_ENABLE_Enabled;
226}
227
228NRF_STATIC_INLINE void nrf_can_disable(NRF_CAN_Type * p_reg)
229{
230 p_reg->ENABLE = SP_CAN_ENABLE_ENABLE_Disabled;
231}
232
233NRF_STATIC_INLINE bool nrf_can_enable_check(NRF_CAN_Type const * p_reg)
234{
235 return (bool)(p_reg->ENABLE & SP_CAN_ENABLE_ENABLE_Msk);
236}
237
238NRF_STATIC_INLINE void nrf_can_event_clear(NRF_CAN_Type * p_reg, nrf_can_event_t event)
239{
240 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
241 nrf_event_readback((uint8_t *)p_reg + (uint32_t)event);
242}
243
244NRF_STATIC_INLINE bool nrf_can_event_check(NRF_CAN_Type const * p_reg, nrf_can_event_t event)
245{
246 return nrf_event_check(p_reg, event);
247}
248
249NRF_STATIC_INLINE uint32_t nrf_can_event_address_get(NRF_CAN_Type const * p_reg,
250 nrf_can_event_t event)
251{
252 return nrf_task_event_address_get(p_reg, event);
253}
254
255NRF_STATIC_INLINE void nrf_can_int_enable(NRF_CAN_Type * p_reg, uint32_t mask)
256{
257 p_reg->INTEN |= mask;
258}
259
260NRF_STATIC_INLINE uint32_t nrf_can_int_enable_check(NRF_CAN_Type const * p_reg, uint32_t mask)
261{
262 return p_reg->INTEN & mask;
263}
264
265NRF_STATIC_INLINE void nrf_can_int_disable(NRF_CAN_Type * p_reg, uint32_t mask)
266{
267 p_reg->INTEN &= ~mask;
268}
269
270NRF_STATIC_INLINE void nrf_can_rxfilter_set(NRF_CAN_Type * p_reg,
271 nrf_can_rxfilter_t const * p_rxfilter,
272 uint8_t index)
273{
274 p_reg->RXFILTER[index].IDFILTER = p_rxfilter->filter & SP_CAN_RXFILTER_IDFILTER_IDENTIFIER_Msk;
275 p_reg->RXFILTER[index].IDMASK = (p_rxfilter->id_mask & SP_CAN_RXFILTER_IDMASK_MASK_Msk) |
276 ((p_rxfilter->filterwidth
279}
280
281NRF_STATIC_INLINE void nrf_can_rxfilter_get(NRF_CAN_Type const * p_reg,
282 nrf_can_rxfilter_t * p_rxfilter,
283 uint8_t index)
284{
285 p_rxfilter->filter = p_reg->RXFILTER[index].IDFILTER &
287 p_rxfilter->id_mask = p_reg->RXFILTER[index].IDMASK & SP_CAN_RXFILTER_IDMASK_MASK_Msk;
288 p_rxfilter->filterwidth = (p_reg->RXFILTER[index].IDMASK &
291}
292
293NRF_STATIC_INLINE void nrf_can_rxfilter_usefilter_set(NRF_CAN_Type * p_reg,
294 uint8_t index,
295 uint8_t value)
296{
297 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
301}
302
303NRF_STATIC_INLINE bool nrf_can_rxfilter_usefilter_get(NRF_CAN_Type const * p_reg, uint8_t index)
304{
305 if ((p_reg->RXFILTER[index].IDFILTER & SP_CAN_RXFILTER_IDFILTER_USEFILTER_Msk)
307 {
308 return true;
309 }
310 return false;
311}
312
314 uint8_t index,
315 uint8_t value)
316{
317 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
321}
322
323NRF_STATIC_INLINE bool nrf_can_rxfilter_filtermatched_get(NRF_CAN_Type const * p_reg, uint8_t index)
324{
325 if ((p_reg->RXFILTER[index].IDFILTER & SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Msk)
327 {
328 return true;
329 }
330 return false;
331}
332
333NRF_STATIC_INLINE void nrf_can_rxfilter_inmailbox_set(NRF_CAN_Type * p_reg,
334 uint8_t index,
335 uint8_t value)
336{
337 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
341}
342
343NRF_STATIC_INLINE bool nrf_can_rxfilter_inmailbox_get(NRF_CAN_Type const * p_reg, uint8_t index)
344{
345 if ((p_reg->RXFILTER[index].IDFILTER & SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Msk)
347 {
348 return true;
349 }
350 return false;
351}
352
353NRF_STATIC_INLINE void nrf_can_rxfilter_filterwidth_set(NRF_CAN_Type * p_reg,
354 uint8_t index,
355 uint8_t value)
356{
357 p_reg->RXFILTER[index].IDMASK = (p_reg->RXFILTER[index].IDMASK &
361}
362
363NRF_STATIC_INLINE uint8_t nrf_can_rxfilter_filterwidth_get(NRF_CAN_Type const * p_reg,
364 uint8_t index)
365{
366 return (uint8_t)((p_reg->RXFILTER[index].IDMASK & SP_CAN_RXFILTER_IDMASK_FILTERWIDTH_Msk)
368}
369
370NRF_STATIC_INLINE void nrf_can_set_parsing_timing(NRF_CAN_Type * p_reg)
371{
372 p_reg->CONFIG.PARSING = NRF_CAN_PARSING_TIMING;
373}
374
375NRF_STATIC_INLINE void nrf_can_set_parsing_mode(NRF_CAN_Type * p_reg)
376{
377 p_reg->CONFIG.PARSING = NRF_CAN_PARSING_MODE;
378}
379
380NRF_STATIC_INLINE void nrf_can_set_parsing_rxfilter(NRF_CAN_Type * p_reg)
381{
382 p_reg->CONFIG.PARSING = NRF_CAN_PARSING_RXFILTER;
383}
384
385NRF_STATIC_INLINE void nrf_can_set_parsing_dppi(NRF_CAN_Type * p_reg)
386{
387 p_reg->CONFIG.PARSING = NRF_CAN_PARSING_DPPI;
388}
389
390NRF_STATIC_INLINE void nrf_can_config_set(NRF_CAN_Type * p_reg, nrf_can_config_t const * p_config)
391{
392 p_reg->CONFIG.TIMING = p_config->timing;
393 p_reg->CONFIG.REQUEST = ((uint32_t)p_config->request) &
395 p_reg->CONFIG.MODE = (((uint32_t)p_config->mode) &
397}
398
399NRF_STATIC_INLINE void nrf_can_config_get(NRF_CAN_Type const * p_reg, nrf_can_config_t * p_config)
400{
401 p_config->timing = p_reg->CONFIG.TIMING;
402 p_config->request = (nrf_can_request_t)(p_reg->CONFIG.REQUEST &
404 p_config->mode = (nrf_can_mode_t)(p_reg->CONFIG.MODE &
406}
407
408NRF_STATIC_INLINE void nrf_can_txframe_set(NRF_CAN_Type * p_reg,
409 uint8_t idx,
410 nrf_can_frame_t const * p_frame)
411{
412 p_reg->TXFRAME[idx].IDENTIFIER = (p_frame->identifier
415
416 p_reg->TXFRAME[idx].TXDATAL = ((uint32_t)p_frame->data[0] << 0) | ((uint32_t)p_frame->data[1]
417 << 8) |
418 ((uint32_t)p_frame->data[2]
419 << 16) | ((uint32_t)p_frame->data[3] << 24);
420
421 p_reg->TXFRAME[idx].TXDATAH = ((uint32_t)p_frame->data[4] << 0) | ((uint32_t)p_frame->data[5]
422 << 8) |
423 ((uint32_t)p_frame->data[6]
424 << 16) | ((uint32_t)p_frame->data[7] << 24);
425
426 p_reg->TXFRAME[idx].METADATA = (((uint32_t)p_frame->extended_format
429 (((uint32_t)p_frame->remote_request
432 (((uint32_t)p_frame->length
435 (((uint32_t)p_frame->crc << SP_CAN_TXFRAME_METADATA_CRC_Pos) &
437}
438
439NRF_STATIC_INLINE void nrf_can_txframe_get(NRF_CAN_Type const * p_reg,
440 uint8_t idx,
441 nrf_can_frame_t * p_frame)
442{
443 uint32_t identifier = p_reg->TXFRAME[idx].IDENTIFIER;
444
447
448 uint32_t datal = p_reg->TXFRAME[idx].TXDATAL;
449 p_frame->data[0] = (uint8_t)(datal >> 0);
450 p_frame->data[1] = (uint8_t)(datal >> 8);
451 p_frame->data[2] = (uint8_t)(datal >> 16);
452 p_frame->data[3] = (uint8_t)(datal >> 24);
453
454 uint32_t datah = p_reg->TXFRAME[idx].TXDATAH;
455 p_frame->data[4] = (uint8_t)(datah >> 0);
456 p_frame->data[5] = (uint8_t)(datah >> 8);
457 p_frame->data[6] = (uint8_t)(datah >> 16);
458 p_frame->data[7] = (uint8_t)(datah >> 24);
459
460 uint32_t metadata = p_reg->TXFRAME[idx].METADATA;
463 p_frame->remote_request = (bool)((metadata & SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Msk)
465 p_frame->length = (uint8_t)((metadata & SP_CAN_TXFRAME_METADATA_DATALENGTH_Msk)
467 p_frame->crc = (uint16_t)((metadata & SP_CAN_TXFRAME_METADATA_CRC_Msk)
469}
470
471NRF_STATIC_INLINE void nrf_can_rxframe_set(NRF_CAN_Type * p_reg,
472 uint8_t idx,
473 nrf_can_frame_t const * p_frame)
474{
475 p_reg->RXFRAME[idx].IDENTIFIER = (p_frame->identifier
478
479 p_reg->RXFRAME[idx].RXDATAL = ((uint32_t)p_frame->data[0] << 0) | ((uint32_t)p_frame->data[1]
480 << 8) |
481 ((uint32_t)p_frame->data[2]
482 << 16) | ((uint32_t)p_frame->data[3] << 24);
483
484 p_reg->RXFRAME[idx].RXDATAH = ((uint32_t)p_frame->data[4] << 0) | ((uint32_t)p_frame->data[5]
485 << 8) |
486 ((uint32_t)p_frame->data[6]
487 << 16) | ((uint32_t)p_frame->data[7] << 24);
488
489 p_reg->RXFRAME[idx].METADATA = (((uint32_t)p_frame->extended_format
492 (((uint32_t)p_frame->remote_request
495 (((uint32_t)p_frame->length
498 (((uint32_t)p_frame->crc << SP_CAN_RXFRAME_METADATA_CRC_Pos) &
500}
501
502NRF_STATIC_INLINE void nrf_can_rxframe_get(NRF_CAN_Type const * p_reg,
503 uint8_t idx,
504 nrf_can_frame_t * p_frame)
505{
506 uint32_t identifier = p_reg->RXFRAME[idx].IDENTIFIER;
507
510
511 uint32_t datal = p_reg->RXFRAME[idx].RXDATAL;
512 p_frame->data[0] = (uint8_t)(datal >> 0);
513 p_frame->data[1] = (uint8_t)(datal >> 8);
514 p_frame->data[2] = (uint8_t)(datal >> 16);
515 p_frame->data[3] = (uint8_t)(datal >> 24);
516
517 uint32_t datah = p_reg->RXFRAME[idx].RXDATAH;
518 p_frame->data[4] = (uint8_t)(datah >> 0);
519 p_frame->data[5] = (uint8_t)(datah >> 8);
520 p_frame->data[6] = (uint8_t)(datah >> 16);
521 p_frame->data[7] = (uint8_t)(datah >> 24);
522
523 uint32_t metadata = p_reg->RXFRAME[idx].METADATA;
526 p_frame->remote_request = (bool)((metadata & SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Msk)
528 p_frame->length = (uint8_t)((metadata & SP_CAN_RXFRAME_METADATA_DATALENGTH_Msk)
530 p_frame->crc = (uint16_t)((metadata & SP_CAN_RXFRAME_METADATA_CRC_Msk)
532}
533
534NRF_STATIC_INLINE nrf_can_state_t nrf_can_state_get(NRF_CAN_Type const * p_reg)
535{
536 return (p_reg->STATUS.STATUS & SP_CAN_STATUS_STATUS_STATE_Msk)
538}
539
540NRF_STATIC_INLINE uint32_t nrf_can_error_get(NRF_CAN_Type const * p_reg)
541{
542 return (p_reg->STATUS.STATUS & 0x1FF);
543}
544
553
554NRF_STATIC_INLINE void nrf_can_handshake_set(NRF_CAN_Type * p_reg, uint32_t val, uint8_t idx)
555{
556 p_reg->SPSYNC.AUX[idx] = val;
557}
558
559NRF_STATIC_INLINE uint32_t nrf_can_handshake_get(NRF_CAN_Type const * p_reg, uint8_t idx)
560{
561 return p_reg->SPSYNC.AUX[idx];
562}
563
564#endif // NRF_DECLARE_ONLY
565
567
568#ifdef __cplusplus
569}
570#endif
571
572#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:439
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:390
NRF_STATIC_INLINE uint32_t nrf_can_int_enable_check(NRF_SP_CAN_Type const *p_reg, uint32_t mask)
Definition nrf_can.h:260
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:281
NRF_STATIC_INLINE void nrf_can_int_enable(NRF_SP_CAN_Type *p_reg, uint32_t mask)
Definition nrf_can.h:255
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:249
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:333
NRF_STATIC_INLINE void nrf_can_task_trigger(NRF_SP_CAN_Type *p_reg, nrf_can_task_t task)
Definition nrf_can.h:213
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:471
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:399
NRF_STATIC_INLINE nrf_can_state_t nrf_can_state_get(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:534
nrf_can_state_t
Definition nrf_can.h:82
@ NRF_CAN_STATE_ERRORACTIVE
Definition nrf_can.h:83
@ NRF_CAN_STATE_ERRORPASSIVE
Definition nrf_can.h:85
@ NRF_CAN_STATE_BUSOFF
Definition nrf_can.h:86
@ NRF_CAN_STATE_ERRORWARNING
Definition nrf_can.h:84
@ NRF_CAN_STATE_STOPPED
Definition nrf_can.h:87
NRF_STATIC_INLINE void nrf_can_enable(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:223
NRF_STATIC_INLINE void nrf_can_disable(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:228
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:408
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:502
NRF_STATIC_INLINE void nrf_can_set_parsing_dppi(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:385
NRF_STATIC_INLINE bool nrf_can_rxfilter_filtermatched_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:323
NRF_STATIC_INLINE uint8_t nrf_can_rxfilter_filterwidth_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:363
NRF_STATIC_INLINE void nrf_can_task_untrigger(NRF_SP_CAN_Type *p_reg, nrf_can_task_t task)
Definition nrf_can.h:218
NRF_STATIC_INLINE bool nrf_can_enable_check(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:233
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:313
NRF_STATIC_INLINE void nrf_can_set_parsing_timing(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:370
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:380
NRF_STATIC_INLINE bool nrf_can_rxfilter_usefilter_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:303
nrf_can_mode_t
CAN operation modes.
Definition nrf_can.h:74
@ NRF_CAN_MODE_LOOPBACK
Definition nrf_can.h:76
@ NRF_CAN_MODE_LISTENONLY
Definition nrf_can.h:77
@ NRF_CAN_MODE_ONESHOT
Definition nrf_can.h:78
@ NRF_CAN_MODE_NORMAL
Definition nrf_can.h:75
NRF_STATIC_INLINE uint32_t nrf_can_handshake_get(NRF_SP_CAN_Type const *p_reg, uint8_t idx)
Definition nrf_can.h:559
NRF_STATIC_INLINE void nrf_can_handshake_set(NRF_SP_CAN_Type *p_reg, uint32_t val, uint8_t idx)
Definition nrf_can.h:554
NRF_STATIC_INLINE bool nrf_can_rxfilter_inmailbox_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:343
NRF_STATIC_INLINE void nrf_can_set_parsing_mode(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:375
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_DPPI
Definition nrf_can.h:69
@ 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:270
NRF_STATIC_INLINE bool nrf_can_event_check(NRF_SP_CAN_Type const *p_reg, nrf_can_event_t event)
Definition nrf_can.h:244
NRF_STATIC_INLINE uint32_t nrf_can_error_get(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:540
NRF_STATIC_INLINE void nrf_can_rxfilter_filterwidth_set(NRF_SP_CAN_Type *p_reg, uint8_t index, uint8_t value)
Definition nrf_can.h:353
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:293
NRF_STATIC_INLINE void nrf_can_int_disable(NRF_SP_CAN_Type *p_reg, uint32_t mask)
Definition nrf_can.h:265
NRF_STATIC_INLINE bool nrf_can_status_error_check(uint32_t error_mask)
Definition nrf_can.h:545
NRF_STATIC_INLINE void nrf_can_event_clear(NRF_SP_CAN_Type *p_reg, nrf_can_event_t event)
Definition nrf_can.h:238
#define NRF_CAN_Type
Definition nrf_can.h:19
#define SP_CAN_INTEN_RXCOMPLETE_Msk
Definition nrf_sp_can.h:774
#define SP_CAN_CONFIG_MODE_MODE_Msk
Definition nrf_sp_can.h:84
#define SP_CAN_CONFIG_MODE_MODE_Loopback
Definition nrf_sp_can.h:88
#define SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Msk
Definition nrf_sp_can.h:245
#define SP_CAN_STATUS_STATUS_FORMERROR_Msk
Definition nrf_sp_can.h:387
#define SP_CAN_STATUS_STATUS_STATE_ERRORPASSIVE
Definition nrf_sp_can.h:431
#define SP_CAN_STATUS_STATUS_STATE_ERRORACTIVE
Definition nrf_sp_can.h:429
#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:77
#define SP_CAN_RXFRAME_METADATA_DATALENGTH_Pos
Definition nrf_sp_can.h:352
#define SP_CAN_CONFIG_MODE_MODE_ListenOnly
Definition nrf_sp_can.h:89
#define SP_CAN_INTEN_TXCOMPLETE_Msk
Definition nrf_sp_can.h:766
#define SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Msk
Definition nrf_sp_can.h:128
#define SP_CAN_TXFRAME_METADATA_DATALENGTH_Msk
Definition nrf_sp_can.h:256
#define SP_CAN_ENABLE_ENABLE_Msk
Definition nrf_sp_can.h:801
#define SP_CAN_RXFRAME_IDENTIFIER_IDENTIFIER_Pos
Definition nrf_sp_can.h:282
#define SP_CAN_RXFILTER_IDFILTER_USEFILTER_Pos
Definition nrf_sp_can.h:116
#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:283
#define SP_CAN_RXFILTER_IDMASK_FILTERWIDTH_Msk
Definition nrf_sp_can.h:157
#define SP_CAN_STATUS_STATUS_STATE_Msk
Definition nrf_sp_can.h:426
#define SP_CAN_RXFILTER_IDFILTER_IDENTIFIER_Msk
Definition nrf_sp_can.h:110
#define SP_CAN_CONFIG_PARSING_REGGROUP_Dppi
Definition nrf_sp_can.h:46
#define SP_CAN_RXFRAME_METADATA_CRC_Pos
Definition nrf_sp_can.h:357
#define SP_CAN_RXFILTER_IDMASK_MASK_Msk
Definition nrf_sp_can.h:153
#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:127
#define SP_CAN_STATUS_STATUS_BITERROR_Msk
Definition nrf_sp_can.h:376
#define SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Pos
Definition nrf_sp_can.h:138
#define SP_CAN_INTEN_STATECHANGED_Msk
Definition nrf_sp_can.h:790
#define SP_CAN_STATUS_STATUS_ACKERROR_Msk
Definition nrf_sp_can.h:391
#define SP_CAN_TXFRAME_METADATA_EXTENDEDFORMAT_Msk
Definition nrf_sp_can.h:234
#define SP_CAN_TXFRAME_IDENTIFIER_IDENTIFIER_Pos
Definition nrf_sp_can.h:185
#define SP_CAN_STATUS_STATUS_CRCERROR_Msk
Definition nrf_sp_can.h:395
#define SP_CAN_TXFRAME_METADATA_EXTENDEDFORMAT_Pos
Definition nrf_sp_can.h:233
#define SP_CAN_RXFRAME_METADATA_EXTENDEDFORMAT_Msk
Definition nrf_sp_can.h:331
#define SP_CAN_CONFIG_MODE_MODE_OneShot
Definition nrf_sp_can.h:90
#define SP_CAN_RXFILTER_IDFILTER_USEFILTER_Msk
Definition nrf_sp_can.h:117
#define SP_CAN_STATUS_STATUS_STATE_BUSOFF
Definition nrf_sp_can.h:432
#define SP_CAN_TXFRAME_IDENTIFIER_IDENTIFIER_Msk
Definition nrf_sp_can.h:186
#define SP_CAN_TXFRAME_METADATA_CRC_Pos
Definition nrf_sp_can.h:260
#define SP_CAN_CONFIG_REQUEST_REQUEST_RX
Definition nrf_sp_can.h:76
#define SP_CAN_CONFIG_PARSING_REGGROUP_RxFilters
Definition nrf_sp_can.h:45
#define SP_CAN_INTEN_ERRORDETECTED_Msk
Definition nrf_sp_can.h:782
#define SP_CAN_CONFIG_REQUEST_REQUEST_Msk
Definition nrf_sp_can.h:73
#define SP_CAN_ENABLE_ENABLE_Disabled
Definition nrf_sp_can.h:804
#define SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Msk
Definition nrf_sp_can.h:139
#define SP_CAN_RXFRAME_METADATA_DATALENGTH_Msk
Definition nrf_sp_can.h:353
#define SP_CAN_STATUS_STATUS_PROTOCOLERROR_Msk
Definition nrf_sp_can.h:407
#define SP_CAN_STATUS_STATUS_STATE_Pos
Definition nrf_sp_can.h:425
#define SP_CAN_RXFRAME_METADATA_CRC_Msk
Definition nrf_sp_can.h:358
#define SP_CAN_TXFRAME_METADATA_CRC_Msk
Definition nrf_sp_can.h:261
#define SP_CAN_RXFILTER_IDMASK_FILTERWIDTH_Pos
Definition nrf_sp_can.h:156
#define SP_CAN_RXFRAME_METADATA_EXTENDEDFORMAT_Pos
Definition nrf_sp_can.h:330
#define SP_CAN_STATUS_STATUS_STATE_STOPPED
Definition nrf_sp_can.h:433
#define SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Msk
Definition nrf_sp_can.h:342
#define SP_CAN_ENABLE_ENABLE_Enabled
Definition nrf_sp_can.h:805
#define SP_CAN_TXFRAME_METADATA_DATALENGTH_Pos
Definition nrf_sp_can.h:255
#define SP_CAN_CONFIG_MODE_MODE_Normal
Definition nrf_sp_can.h:87
#define SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Pos
Definition nrf_sp_can.h:244
#define SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Pos
Definition nrf_sp_can.h:341
#define SP_CAN_STATUS_STATUS_STATE_ERRORWARNING
Definition nrf_sp_can.h:430
#define SP_CAN_STATUS_STATUS_BITSTUFFINGERROR_Msk
Definition nrf_sp_can.h:380
nrf_can_request_t request
Definition nrf_can.h:94
nrf_can_mode_t mode
Definition nrf_can.h:95
uint32_t timing
Definition nrf_can.h:93
CAN configuration structure.
Definition nrf_can.h:92
bool remote_request
Definition nrf_can.h:113
bool extended_format
Definition nrf_can.h:112
uint16_t crc
Definition nrf_can.h:111
uint8_t data[8]
Definition nrf_can.h:110
uint8_t length
Definition nrf_can.h:109
uint32_t identifier
Definition nrf_can.h:108
CAN frame structure.
Definition nrf_can.h:107
uint32_t filterwidth
Definition nrf_can.h:102
uint32_t id_mask
Definition nrf_can.h:101
uint32_t filter
Definition nrf_can.h:100
Definition nrf_can.h:99