Skip to content

Conversation

@solomondg
Copy link
Contributor

Changes:

  • Add ODriveESP32TWAI.hpp interface
  • Add IS_ESP32_TWAI option to SineWaveCAN example
  • Add esp32 PlatformIO target

This PR supersedes #11 .

Not tested yet - will desk test ASAP.

Changes:
- Add ODriveESP32TWAI.hpp interface that calls twai_transmit/twai_receive directly
- Add IS_ESP32_TWAI option to SineWaveCAN example
- Add esp32 PlatformIO target
@CLAassistant
Copy link

CLAassistant commented Jan 6, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@samuelsadok samuelsadok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending desk test.

return false;
}

can_intf.initialized = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arguably it is the user's responsibility to call setupCan() before using the interface. Our other CAN drivers don't do this check.

twai_message_t tx_msg = {};
tx_msg.identifier = id;
tx_msg.data_length_code = length;
tx_msg.extd = (id > 0x7FF) ? 1 : 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing drivers use id & 0x80000000 as the extended-id flag, so we should do the same here.

}
}

return twai_transmit(&tx_msg, pdMS_TO_TICKS(100)) == ESP_OK;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the timeout makes this look like it blocks until the message is sent. But I think all other drivers are non-blocking. Is there any non-blocking version of this call? Or is this non-blocking and the timeout is more like a time-to-live for the message?

https://github.com/pazi88/STM32_CAN.git#1.2.0
https://github.com/pazi88/STM32_CAN.git#1.2.0

[env:esp32]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

picked up by CI and compiles, great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants