From 7d650e138729524f36caf46ff57e6b11f641915d Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 13 Apr 2024 13:49:04 -0400 Subject: [PATCH] only: preparing to reduce magic number duplication --- firmware/hw_layer/openblt/blt_conf.h | 9 +++------ firmware/hw_layer/openblt/efi_blt_ids.h | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 firmware/hw_layer/openblt/efi_blt_ids.h diff --git a/firmware/hw_layer/openblt/blt_conf.h b/firmware/hw_layer/openblt/blt_conf.h index 5bf488a21d..2c7a27e950 100644 --- a/firmware/hw_layer/openblt/blt_conf.h +++ b/firmware/hw_layer/openblt/blt_conf.h @@ -28,6 +28,8 @@ #ifndef BLT_CONF_H #define BLT_CONF_H +#include "efi_blt_ids.h" + /**************************************************************************************** * C P U D R I V E R C O N F I G U R A T I O N ****************************************************************************************/ @@ -85,14 +87,9 @@ */ /** \brief Enable/disable CAN transport layer. */ #define BOOT_COM_CAN_ENABLE (1) -/** \brief Configure the desired CAN baudrate. */ -#define BOOT_COM_CAN_BAUDRATE (500000) -/** \brief Configure CAN message ID target->host. */ -#define BOOT_COM_CAN_TX_MSG_ID (0x7E1 /*| 0x80000000*/) /** \brief Configure number of bytes in the target->host CAN message. */ #define BOOT_COM_CAN_TX_MAX_DATA (8) -/** \brief Configure CAN message ID host->target. */ -#define BOOT_COM_CAN_RX_MSG_ID (0x667 /*| 0x80000000*/) + /** \brief Configure number of bytes in the host->target CAN message. */ #define BOOT_COM_CAN_RX_MAX_DATA (8) /** \brief Select the desired CAN peripheral as a zero based index. */ diff --git a/firmware/hw_layer/openblt/efi_blt_ids.h b/firmware/hw_layer/openblt/efi_blt_ids.h new file mode 100644 index 0000000000..b316055035 --- /dev/null +++ b/firmware/hw_layer/openblt/efi_blt_ids.h @@ -0,0 +1,18 @@ +// file efi_blt_ids.h + +#ifndef BOOT_COM_CAN_BAUDRATE +/** \brief Configure the desired CAN baudrate. */ +#define BOOT_COM_CAN_BAUDRATE (500000) +#endif + +#ifndef BOOT_COM_CAN_RX_MSG_ID +// PC or Android device doing the programming +/** \brief Configure CAN message ID host->target. */ +#define BOOT_COM_CAN_RX_MSG_ID (0x667 /*| 0x80000000*/) +#endif + +#ifndef BOOT_COM_CAN_TX_MSG_ID +// ECU talks this CAN is +/** \brief Configure CAN message ID target->host. */ +#define BOOT_COM_CAN_TX_MSG_ID (0x7E1 /*| 0x80000000*/) +#endif