From a588f15808ecb6c1cda930e7f33d1f9be5a3079b Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Tue, 28 Mar 2023 00:01:21 -0700 Subject: [PATCH] board can override CAN format --- firmware/can.cpp | 8 +++++++- firmware/can.h | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/firmware/can.cpp b/firmware/can.cpp index 184ff33..f0c95c2 100644 --- a/firmware/can.cpp +++ b/firmware/can.cpp @@ -22,7 +22,7 @@ void CanTxThread(void*) while(1) { for (int ch = 0; ch < AFR_CHANNELS; ch++) { - SendRusefiFormat(ch); + SendCanForChannel(ch); } chThdSleepMilliseconds(10); @@ -161,3 +161,9 @@ void SendRusefiFormat(uint8_t ch) frame.get().HeaterDuty = GetHeaterDuty(ch) * 255; } } + +// Weak link so boards can override it +__attribute__((weak)) void SendCanForChannel(uint8_t ch) +{ + SendRusefiFormat(ch); +} diff --git a/firmware/can.h b/firmware/can.h index 763450e..38105f0 100644 --- a/firmware/can.h +++ b/firmware/can.h @@ -20,3 +20,7 @@ enum class HeaterAllow { HeaterAllow GetHeaterAllowed(); float GetRemoteBatteryVoltage(); + +// implement this for your board if you want some non-standard behavior +// default implementation simply calls SendRusefiFormat +void SendCanForChannel(uint8_t ch);