From 710a512fe755fdd3d1af0b426feb4776df0078e4 Mon Sep 17 00:00:00 2001 From: Andrey G Date: Sun, 16 May 2021 13:01:00 +0300 Subject: [PATCH] Hw layer rearrangement (#2703) * max31855: move to sensors * uart GPS driver: move to sensors and rename * i2c_bb: move to drivers * LCD HD44780: move to drivers * ping? --- firmware/console/status_loop.cpp | 2 +- firmware/controllers/core/error_handling.cpp | 2 +- firmware/controllers/gauges/lcd_controller.cpp | 2 +- firmware/hw_layer/drivers/drivers.mk | 6 +++++- firmware/hw_layer/{ => drivers/i2c}/i2c_bb.cpp | 0 firmware/hw_layer/{ => drivers/i2c}/i2c_bb.h | 0 .../{lcd/lcd_HD44780.cpp => drivers/lcd/HD44780.cpp} | 4 ++-- .../hw_layer/{lcd/lcd_HD44780.h => drivers/lcd/HD44780.h} | 2 +- firmware/hw_layer/hardware.cpp | 4 ++-- firmware/hw_layer/hw_layer.mk | 8 +------- firmware/hw_layer/{neo6m.cpp => sensors/gps_uart.c} | 8 ++++---- firmware/hw_layer/{neo6m.h => sensors/gps_uart.h} | 2 +- firmware/hw_layer/{ => sensors}/max31855.cpp | 0 firmware/hw_layer/{ => sensors}/max31855.h | 0 firmware/hw_layer/sensors/sensors.mk | 2 ++ firmware/rusefi.cpp | 4 ---- 16 files changed, 21 insertions(+), 25 deletions(-) rename firmware/hw_layer/{ => drivers/i2c}/i2c_bb.cpp (100%) rename firmware/hw_layer/{ => drivers/i2c}/i2c_bb.h (100%) rename firmware/hw_layer/{lcd/lcd_HD44780.cpp => drivers/lcd/HD44780.cpp} (99%) rename firmware/hw_layer/{lcd/lcd_HD44780.h => drivers/lcd/HD44780.h} (95%) rename firmware/hw_layer/{neo6m.cpp => sensors/gps_uart.c} (96%) rename firmware/hw_layer/{neo6m.h => sensors/gps_uart.h} (92%) rename firmware/hw_layer/{ => sensors}/max31855.cpp (100%) rename firmware/hw_layer/{ => sensors}/max31855.h (100%) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 7d2e76a7e0..46a6be9469 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -69,7 +69,7 @@ extern bool main_loop_started; #if EFI_PROD_CODE // todo: move this logic to algo folder! #include "rtc_helper.h" -#include "lcd_HD44780.h" +#include "HD44780.h" #include "rusefi.h" #include "pin_repository.h" #include "flash_main.h" diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index 39380686f4..e07a3a9436 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -13,7 +13,7 @@ static critical_msg_t warningBuffer; static critical_msg_t criticalErrorMessageBuffer; #if EFI_HD44780_LCD -#include "lcd_HD44780.h" +#include "HD44780.h" #endif /* EFI_HD44780_LCD */ EXTERN_ENGINE; diff --git a/firmware/controllers/gauges/lcd_controller.cpp b/firmware/controllers/gauges/lcd_controller.cpp index 8e50475e30..ddd4534fec 100644 --- a/firmware/controllers/gauges/lcd_controller.cpp +++ b/firmware/controllers/gauges/lcd_controller.cpp @@ -22,7 +22,7 @@ #include "os_access.h" #include "lcd_controller.h" -#include "lcd_HD44780.h" +#include "HD44780.h" #include "rpm_calculator.h" #include "allsensors.h" #include "engine.h" diff --git a/firmware/hw_layer/drivers/drivers.mk b/firmware/hw_layer/drivers/drivers.mk index 69369f18bc..236205bcf7 100644 --- a/firmware/hw_layer/drivers/drivers.mk +++ b/firmware/hw_layer/drivers/drivers.mk @@ -5,6 +5,8 @@ HW_LAYER_DRIVERS_INC = \ $(DRIVERS_DIR)/gpio \ $(DRIVERS_DIR)/can \ $(DRIVERS_DIR)/serial \ + $(DRIVERS_DIR)/i2c \ + $(DRIVERS_DIR)/lcd \ HW_LAYER_DRIVERS_CORE = \ $(DRIVERS_DIR)/gpio/core.c \ @@ -21,4 +23,6 @@ HW_LAYER_DRIVERS = \ HW_LAYER_DRIVERS_CPP = \ $(DRIVERS_DIR)/can/can_hw.cpp \ $(DRIVERS_DIR)/can/can_msg_tx.cpp \ - $(DRIVERS_DIR)/serial/serial_hw.cpp + $(DRIVERS_DIR)/serial/serial_hw.cpp \ + $(DRIVERS_DIR)/i2c/i2c_bb.cpp \ + $(DRIVERS_DIR)/lcd/HD44780.cpp diff --git a/firmware/hw_layer/i2c_bb.cpp b/firmware/hw_layer/drivers/i2c/i2c_bb.cpp similarity index 100% rename from firmware/hw_layer/i2c_bb.cpp rename to firmware/hw_layer/drivers/i2c/i2c_bb.cpp diff --git a/firmware/hw_layer/i2c_bb.h b/firmware/hw_layer/drivers/i2c/i2c_bb.h similarity index 100% rename from firmware/hw_layer/i2c_bb.h rename to firmware/hw_layer/drivers/i2c/i2c_bb.h diff --git a/firmware/hw_layer/lcd/lcd_HD44780.cpp b/firmware/hw_layer/drivers/lcd/HD44780.cpp similarity index 99% rename from firmware/hw_layer/lcd/lcd_HD44780.cpp rename to firmware/hw_layer/drivers/lcd/HD44780.cpp index 75108da0df..007281365c 100644 --- a/firmware/hw_layer/lcd/lcd_HD44780.cpp +++ b/firmware/hw_layer/drivers/lcd/HD44780.cpp @@ -1,5 +1,5 @@ /** - * @file lcd_HD44780.cpp + * @file HD44780.cpp * @brief HD44780 character display driver * * see http://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller @@ -11,7 +11,7 @@ #if EFI_HD44780_LCD -#include "lcd_HD44780.h" +#include "HD44780.h" #include "pin_repository.h" #include "string.h" diff --git a/firmware/hw_layer/lcd/lcd_HD44780.h b/firmware/hw_layer/drivers/lcd/HD44780.h similarity index 95% rename from firmware/hw_layer/lcd/lcd_HD44780.h rename to firmware/hw_layer/drivers/lcd/HD44780.h index e4fb102b3a..3dab4b1576 100644 --- a/firmware/hw_layer/lcd/lcd_HD44780.h +++ b/firmware/hw_layer/drivers/lcd/HD44780.h @@ -1,5 +1,5 @@ /** - * @file lcd_HD44780.h + * @file HD44780.h * * @date 13.12.2013 * @author Andrey Belomutskiy, (c) 2012-2020 diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 9ffeda3faf..a74ce4e94c 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -39,8 +39,8 @@ #include "mcp3208.h" #include "hip9011.h" #include "histogram.h" -#include "neo6m.h" -#include "lcd_HD44780.h" +#include "gps_uart.h" +#include "HD44780.h" #include "settings.h" #include "joystick.h" #include "cdm_ion_sense.h" diff --git a/firmware/hw_layer/hw_layer.mk b/firmware/hw_layer/hw_layer.mk index b3286193c0..aed1fc382e 100644 --- a/firmware/hw_layer/hw_layer.mk +++ b/firmware/hw_layer/hw_layer.mk @@ -7,14 +7,11 @@ HW_LAYER_INC= $(PROJECT_DIR)/hw_layer $(PROJECT_DIR)/hw_layer/adc \ HW_INC = hw_layer/$(CPU_HWLAYER) \ $(PROJECT_DIR)/hw_layer/ports -HW_LAYER_EGT_CPP = \ - $(PROJECT_DIR)/hw_layer/max31855.cpp - HW_LAYER_EMS = $(HW_LAYER_EGT) \ $(PROJECT_DIR)/hw_layer/adc/mcp3208.c \ $(PROJECT_DIR)/hw_layer/mc33816_data.c -HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \ +HW_LAYER_EMS_CPP = \ $(PROJECT_DIR)/hw_layer/pin_repository.cpp \ $(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer.cpp \ $(PROJECT_DIR)/hw_layer/digital_input/digital_input.cpp \ @@ -25,10 +22,8 @@ HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \ $(PROJECT_DIR)/hw_layer/digital_input/trigger/trigger_input_exti.cpp \ $(PROJECT_DIR)/hw_layer/hardware.cpp \ $(PROJECT_DIR)/hw_layer/smart_gpio.cpp \ - $(PROJECT_DIR)/hw_layer/neo6m.cpp \ $(PROJECT_DIR)/hw_layer/mmc_card.cpp \ $(PROJECT_DIR)/hw_layer/mmc_card_access.cpp \ - $(PROJECT_DIR)/hw_layer/lcd/lcd_HD44780.cpp \ $(PROJECT_DIR)/hw_layer/adc/adc_inputs.cpp \ $(PROJECT_DIR)/hw_layer/adc/adc_subscription.cpp \ $(PROJECT_DIR)/hw_layer/adc/ads1015.cpp \ @@ -43,7 +38,6 @@ HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \ $(PROJECT_DIR)/hw_layer/rtc_helper.cpp \ $(PROJECT_DIR)/hw_layer/cdm_ion_sense.cpp \ $(PROJECT_DIR)/hw_layer/debounce.cpp \ - $(PROJECT_DIR)/hw_layer/i2c_bb.cpp \ # diff --git a/firmware/hw_layer/neo6m.cpp b/firmware/hw_layer/sensors/gps_uart.c similarity index 96% rename from firmware/hw_layer/neo6m.cpp rename to firmware/hw_layer/sensors/gps_uart.c index 88da5ced81..26f7e23420 100644 --- a/firmware/hw_layer/neo6m.cpp +++ b/firmware/hw_layer/sensors/gps_uart.c @@ -1,9 +1,9 @@ /** - * @file neo6m.cpp - * @brief Ublox 6M hardware UART driver + * @file gps_uart.cpp + * @brief GPS receiver hardware UART driver * + * Tested and developed for NEO-6M * http://www.u-blox.com/en/gps-modules/pvt-modules/previous-generations/neo-6-family.html - * * Technically any UART GPS should work with this driver since NMEA protocol is pretty common anyway * * @date Dec 28, 2013 @@ -22,7 +22,7 @@ #include "eficonsole.h" #include "pin_repository.h" #include "nmea.h" -#include "neo6m.h" +#include "gps_uart.h" #include "rtc_helper.h" #include "engine.h" diff --git a/firmware/hw_layer/neo6m.h b/firmware/hw_layer/sensors/gps_uart.h similarity index 92% rename from firmware/hw_layer/neo6m.h rename to firmware/hw_layer/sensors/gps_uart.h index e21d1be952..d5b8702986 100644 --- a/firmware/hw_layer/neo6m.h +++ b/firmware/hw_layer/sensors/gps_uart.h @@ -1,5 +1,5 @@ /* - * @file neo6m.h + * @file gps_uart.h * * * @date Dec 30, 2013 diff --git a/firmware/hw_layer/max31855.cpp b/firmware/hw_layer/sensors/max31855.cpp similarity index 100% rename from firmware/hw_layer/max31855.cpp rename to firmware/hw_layer/sensors/max31855.cpp diff --git a/firmware/hw_layer/max31855.h b/firmware/hw_layer/sensors/max31855.h similarity index 100% rename from firmware/hw_layer/max31855.h rename to firmware/hw_layer/sensors/max31855.h diff --git a/firmware/hw_layer/sensors/sensors.mk b/firmware/hw_layer/sensors/sensors.mk index 6c007ac4cd..280733ed00 100644 --- a/firmware/hw_layer/sensors/sensors.mk +++ b/firmware/hw_layer/sensors/sensors.mk @@ -9,4 +9,6 @@ HW_SENSORS_SRC = \ $(HW_SENSORS_DIR)/accelerometer.cpp \ $(HW_SENSORS_DIR)/joystick.cpp \ $(HW_SENSORS_DIR)/lps25.cpp \ + $(HW_SENSORS_DIR)/max31855.cpp \ + $(HW_SENSORS_DIR)/gps_uart.c \ No newline at end of file diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index cb9d898658..1bf9d6050b 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -129,10 +129,6 @@ #include "trigger_emulator_algo.h" #include "rusefi_lua.h" -#if EFI_HD44780_LCD -#include "lcd_HD44780.h" -#endif /* EFI_HD44780_LCD */ - #if EFI_ENGINE_EMULATOR #include "engine_emulator.h" #endif /* EFI_ENGINE_EMULATOR */