17static IntervalTimer currentEcho;
 
   18static uint32_t address;
 
   20static uint8_t buf_curr[8];
 
   23void echo(uint32_t delay, 
const uint32_t address, uint8_t buf[8]) {
 
   24    echo(delay, address, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
 
   27void echo(uint32_t delay, 
const uint32_t address, 
const uint8_t buf_0, 
const uint8_t buf_1, 
const uint8_t buf_2, 
const uint8_t buf_3, 
const uint8_t buf_4, 
const uint8_t buf_5, 
const uint8_t buf_6, 
const uint8_t buf_7) {
 
   28    Canbus::sendData(ADD_ECHO_DATA, buf_0, buf_1, buf_2, buf_3, buf_4, buf_5, buf_6, buf_7);
 
   29    uint64_t block = delay;
 
   32    Canbus::sendData(ADD_ECHO_DELAY, (uint8_t *)block);
 
   35static void send(
void) {
 
   36    Canbus::sendData(address, buf_curr);
 
   40static void startEcho() {
 
   42    currentEcho.begin(send, delay);
 
   45static void checkStart() {
 
   53static void receiveBlock(uint32_t _, 
volatile uint8_t *buf) {
 
   54    volatile uint64_t block = *((
volatile uint64_t *)buf);
 
   55    address = block & 0xFFFFFFFF;
 
   60static void receiveBuffer(uint32_t _, 
volatile uint8_t buf[8]) {
 
   73    Canbus::addCallback(ADD_ECHO_DATA, receiveBlock);
 
   74    Canbus::addCallback(ADD_ECHO_DELAY, receiveBuffer);
 
Echo can messages with a delay.
This Module can be used to echo a CAN message over a network of two ECUs.
void setup()
Initialize on receiving ECU to echo messages.
void echo(uint32_t delay, const uint32_t address, uint8_t buf[8])
Send a can message to the back ECU from the front to then echo the same message at a set delay.