File tree Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ extern "C" void canfd_callback(can_callback_args_t * p_args);
33
33
namespace arduino
34
34
{
35
35
36
- canfd_afl_entry_t p_canfd0_afl[CANFD_CFG_AFL_CH0_RULE_NUM];
36
+ extern " C" canfd_afl_entry_t CANFD0_AFL[CANFD_CFG_AFL_CH0_RULE_NUM];
37
+ extern " C" canfd_afl_entry_t CANFD1_AFL[CANFD_CFG_AFL_CH1_RULE_NUM];
37
38
38
39
/* *************************************************************************************
39
40
* CTOR/DTOR
@@ -70,7 +71,7 @@ R7FA6M5_CAN::R7FA6M5_CAN(int const can_tx_pin, int const can_rx_pin)
70
71
}
71
72
, _canfd_extended_cfg
72
73
{
73
- .p_afl = p_canfd0_afl ,
74
+ .p_afl = nullptr ,
74
75
// .txmb_txi_enable = ((1ULL << 9) | (1ULL << 0) | 0ULL),
75
76
.txmb_txi_enable = 0xFFFFFFFFFFFFFFFF ,
76
77
.error_interrupts = (R_CANFD_CFDC_CTR_EWIE_Msk | R_CANFD_CFDC_CTR_EPIE_Msk | R_CANFD_CFDC_CTR_BOEIE_Msk | R_CANFD_CFDC_CTR_BORIE_Msk | R_CANFD_CFDC_CTR_OLIE_Msk | 0U ),
@@ -109,6 +110,14 @@ bool R7FA6M5_CAN::begin(CanBitRate const can_bitrate)
109
110
init_ok &= cfg_init_ok;
110
111
_canfd_cfg.channel = cfg_channel;
111
112
113
+ /* Set the pointer to the right filtering structure. */
114
+ if (_canfd_cfg.channel == 0 )
115
+ _canfd_extended_cfg.p_afl = CANFD0_AFL;
116
+ if (_canfd_cfg.channel == 1 )
117
+ _canfd_extended_cfg.p_afl = CANFD1_AFL;
118
+ else
119
+ init_ok &= false ;
120
+
112
121
/* Configure the interrupts.
113
122
*/
114
123
CanFdIrqReq_t irq_req
Original file line number Diff line number Diff line change 3
3
#include "bsp_api.h"
4
4
#include "hal_data.h"
5
5
6
- extern const canfd_afl_entry_t p_canfd0_afl [CANFD_CFG_AFL_CH0_RULE_NUM ] = {
6
+ canfd_afl_entry_t const CANFD0_AFL [CANFD_CFG_AFL_CH0_RULE_NUM ] = {
7
7
{
8
8
.id =
9
9
{
10
- .id = 0x10 ,
10
+ .id = 0x1FFFFFFF ,
11
11
.frame_type = CAN_FRAME_TYPE_DATA ,
12
- .id_mode = CAN_ID_MODE_STANDARD ,
12
+ .id_mode = CAN_ID_MODE_EXTENDED ,
13
13
},
14
14
.mask =
15
15
{
16
- .mask_id = 0x7F0 ,
16
+ .mask_id = 0 ,
17
17
.mask_frame_type = 1 ,
18
18
.mask_id_mode = 1 ,
19
19
},
@@ -26,25 +26,25 @@ extern const canfd_afl_entry_t p_canfd0_afl[CANFD_CFG_AFL_CH0_RULE_NUM] = {
26
26
}
27
27
};
28
28
29
- extern const canfd_afl_entry_t p_canfd1_afl [CANFD_CFG_AFL_CH1_RULE_NUM ] = {
29
+ canfd_afl_entry_t const CANFD1_AFL [CANFD_CFG_AFL_CH1_RULE_NUM ] = {
30
30
{
31
31
.id =
32
32
{
33
- .id = 0x20 ,
33
+ .id = 0x1FFFFFFF ,
34
34
.frame_type = CAN_FRAME_TYPE_DATA ,
35
- .id_mode = CAN_ID_MODE_STANDARD ,
35
+ .id_mode = CAN_ID_MODE_EXTENDED ,
36
36
},
37
37
.mask =
38
38
{
39
- .mask_id = 0x7F0 ,
39
+ .mask_id = 0 ,
40
40
.mask_frame_type = 1 ,
41
41
.mask_id_mode = 1 ,
42
42
},
43
43
.destination =
44
44
{
45
45
.minimum_dlc = CANFD_MINIMUM_DLC_0 ,
46
- .rx_buffer = (canfd_rx_mb_t ) CANFD_RX_MB_0 ,
47
- .fifo_select_flags = CANFD_RX_FIFO_0 ,
46
+ .rx_buffer = (canfd_rx_mb_t ) CANFD_RX_MB_1 ,
47
+ .fifo_select_flags = CANFD_RX_FIFO_1 ,
48
48
}
49
49
}
50
50
};
You can’t perform that action at this time.
0 commit comments