Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e48879d

Browse files
Enable mixed mode (both standard and extended) frame transmission for Portenta C33.
Note: Mixed mode reception still missing.
1 parent b433f69 commit e48879d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎libraries/Arduino_CAN/src/R7FA6M5_CAN.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,11 @@ int R7FA6M5_CAN::disableInternalLoopback()
190190

191191
int R7FA6M5_CAN::write(CanMsg const & msg)
192192
{
193+
bool const is_standard_id = msg.isStandardId();
194+
193195
can_frame_t can_msg = {
194-
/* id = */ msg.id,
195-
/* id_mode = */ CAN_ID_MODE_EXTENDED,
196+
/* id = */ is_standard_id ? msg.getStandardId() : msg.getExtendedId(),
197+
/* id_mode = */ is_standard_id ? CAN_ID_MODE_STANDARD : CAN_ID_MODE_EXTENDED,
196198
/* type = */ CAN_FRAME_TYPE_DATA,
197199
/* data_length_code = */ min(msg.data_length, CAN_DATA_BUFFER_LENGTH),
198200
/* options = */ 0 /* This ensures that CAN Classic is used. */
@@ -221,7 +223,7 @@ size_t R7FA6M5_CAN::available()
221223
/* Extract the received CAN message. */
222224
CanMsg const msg
223225
(
224-
frame.id,
226+
(frame.id_mode == CAN_ID_MODE_STANDARD) ? CanStandardId(frame.id) : CanExtendedId(frame.id),
225227
frame.data_length_code,
226228
frame.data
227229
);
@@ -247,7 +249,7 @@ void R7FA6M5_CAN::onCanFDCallback(can_callback_args_t * p_args)
247249
/* Extract the received CAN message. */
248250
CanMsg const msg
249251
(
250-
p_args->frame.id,
252+
(p_args->frame.id_mode == CAN_ID_MODE_STANDARD) ? CanStandardId(p_args->frame.id) : CanExtendedId(p_args->frame.id),
251253
p_args->frame.data_length_code,
252254
p_args->frame.data
253255
);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /