From 1870b9245b9dc40ac6e5cb588c1891e11d4c0b40 Mon Sep 17 00:00:00 2001 From: CUAVmengxiao Date: Tue, 29 Mar 2022 13:55:57 +0800 Subject: [PATCH] fmu-v5: add macro definitions for different version revisions --- boards/px4/fmu-v5/src/board_config.h | 7 +++++++ boards/px4/fmu-v5/src/manifest.c | 14 +++++++------- boards/px4/fmu-v5/src/spi.cpp | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/boards/px4/fmu-v5/src/board_config.h b/boards/px4/fmu-v5/src/board_config.h index 4d9aaf9114..ffa8023d8f 100644 --- a/boards/px4/fmu-v5/src/board_config.h +++ b/boards/px4/fmu-v5/src/board_config.h @@ -192,6 +192,13 @@ #define HW_INFO_INIT_VER 2 #define HW_INFO_INIT_REV 3 #define BOARD_NUM_SPI_CFG_HW_VERSIONS 3 +#define V500 HW_VER_REV(0x0,0x0) // FMUV5, Rev 0 +#define V515 HW_VER_REV(0x1,0x5) // CUAV V5, Rev 5 +#define V540 HW_VER_REV(0x4,0x0) // HolyBro mini no can 2,3, Rev 0 +#define V550 HW_VER_REV(0x5,0x0) // CUAV V5+, Rev 0 +#define V552 HW_VER_REV(0x5,0x2) // CUAV V5+ ICM42688P, Rev 2 +#define V560 HW_VER_REV(0x6,0x0) // CUAV V5nano with can 2, Rev 0 +#define V562 HW_VER_REV(0x6,0x2) // CUAV V5nano ICM42688P, Rev 2 /* CAN Silence * diff --git a/boards/px4/fmu-v5/src/manifest.c b/boards/px4/fmu-v5/src/manifest.c index 1f8d49c7ee..3e131f9ada 100644 --- a/boards/px4/fmu-v5/src/manifest.c +++ b/boards/px4/fmu-v5/src/manifest.c @@ -157,13 +157,13 @@ static const px4_hw_mft_item_t hw_mft_list_v0600[] = { static px4_hw_mft_list_entry_t mft_lists[] = { - {0x0000, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, - {0x0105, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5 R:5 V:1 - {0x0500, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5+ R:0 V:5 - {0x0502, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5+ R:2 V:5 ICM42688P - {0x0602, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5nano R:2 V:6 ICM42688P - {0x0400, hw_mft_list_v0540, arraySize(hw_mft_list_v0540)}, // HolyBro mini no can 2,3 - {0x0600, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // CUAV V5nano R:0 V:6 with can 2 + {V500, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, + {V515, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5 R:5 V:1 + {V540, hw_mft_list_v0540, arraySize(hw_mft_list_v0540)}, // HolyBro mini no can 2,3 + {V550, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5+ R:0 V:5 + {V552, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5+ R:2 V:5 ICM42688P + {V560, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // CUAV V5nano R:0 V:6 with can 2 + {V562, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5nano R:2 V:6 ICM42688P }; /************************************************************************************ diff --git a/boards/px4/fmu-v5/src/spi.cpp b/boards/px4/fmu-v5/src/spi.cpp index f51a5d7aba..8a3f8c9b29 100644 --- a/boards/px4/fmu-v5/src/spi.cpp +++ b/boards/px4/fmu-v5/src/spi.cpp @@ -36,7 +36,7 @@ #include constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSIONS] = { - initSPIHWVersion(HW_VER_REV(0, 0), { + initSPIHWVersion(V500, { initSPIBus(SPI::Bus::SPI1, { initSPIDevice(DRV_IMU_DEVTYPE_ICM20689, SPI::CS{GPIO::PortF, GPIO::Pin2}, SPI::DRDY{GPIO::PortB, GPIO::Pin4}), initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortF, GPIO::Pin3}, SPI::DRDY{GPIO::PortC, GPIO::Pin5}), @@ -61,7 +61,7 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION }), }), - initSPIHWVersion(HW_VER_REV(5, 2), { + initSPIHWVersion(V552, { initSPIBus(SPI::Bus::SPI1, { initSPIDevice(DRV_IMU_DEVTYPE_ICM20689, SPI::CS{GPIO::PortF, GPIO::Pin2}, SPI::DRDY{GPIO::PortB, GPIO::Pin4}), initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortF, GPIO::Pin11}, SPI::DRDY{GPIO::PortC, GPIO::Pin5}), @@ -86,7 +86,7 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION }), }), - initSPIHWVersion(HW_VER_REV(6, 2), { + initSPIHWVersion(V562, { initSPIBus(SPI::Bus::SPI1, { initSPIDevice(DRV_IMU_DEVTYPE_ICM20689, SPI::CS{GPIO::PortF, GPIO::Pin2}, SPI::DRDY{GPIO::PortB, GPIO::Pin4}), initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortF, GPIO::Pin11}, SPI::DRDY{GPIO::PortC, GPIO::Pin5}),