PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
374B

  1. #include <FlexCAN_T4.h>
  2. FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> can1;
  3. FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_16> can2;
  4. CAN_message_t msg;
  5. void setup(void) {
  6. can1.begin();
  7. can1.setBaudRate(250000);
  8. can2.begin();
  9. can2.setBaudRate(250000);
  10. }
  11. void loop() {
  12. if ( can1.read(msg) ) {
  13. can2.write(msg);
  14. }
  15. else if ( can2.read(msg) ) {
  16. can1.write(msg);
  17. }
  18. }