From 8f4aecf7cad129179b1eef44b3dc2fd782b509c6 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 2 Aug 2020 20:46:40 -0400 Subject: [PATCH] The Big Refactoring of 2019: folder structure #723 --- firmware/Makefile | 4 +-- .../hw_layer/{ => adc}/AdcConfiguration.h | 0 firmware/hw_layer/{ => adc}/adc_external.h | 0 firmware/hw_layer/{ => adc}/adc_inputs.cpp | 0 firmware/hw_layer/{ => adc}/adc_inputs.h | 0 .../hw_layer/{ => adc}/adc_subscription.cpp | 0 .../hw_layer/{ => adc}/adc_subscription.h | 0 firmware/hw_layer/{ => adc}/mcp3208.c | 0 firmware/hw_layer/{ => adc}/mcp3208.h | 0 .../{ => digital_input}/digital_input.cpp | 0 .../{ => digital_input}/digital_input.h | 0 .../digital_input_exti.cpp | 0 .../{ => digital_input}/digital_input_exti.h | 0 .../{ => digital_input}/digital_input_icu.cpp | 0 .../{ => digital_input}/digital_input_icu.h | 0 .../trigger}/trigger_input.cpp | 0 .../trigger}/trigger_input.h | 0 .../trigger}/trigger_input_comp.cpp | 0 .../trigger}/trigger_input_exti.cpp | 0 .../trigger}/trigger_input_icu.cpp | 0 firmware/hw_layer/hw_layer.mk | 30 +++++++++++-------- firmware/hw_layer/{ => sensors}/hip9011.cpp | 0 firmware/hw_layer/{ => sensors}/hip9011.h | 0 .../hw_layer/{ => sensors}/hip9011_logic.cpp | 0 .../hw_layer/{ => sensors}/hip9011_logic.h | 0 simulator/Makefile | 2 +- unit_tests/Makefile | 3 +- 27 files changed, 21 insertions(+), 18 deletions(-) rename firmware/hw_layer/{ => adc}/AdcConfiguration.h (100%) rename firmware/hw_layer/{ => adc}/adc_external.h (100%) rename firmware/hw_layer/{ => adc}/adc_inputs.cpp (100%) rename firmware/hw_layer/{ => adc}/adc_inputs.h (100%) rename firmware/hw_layer/{ => adc}/adc_subscription.cpp (100%) rename firmware/hw_layer/{ => adc}/adc_subscription.h (100%) rename firmware/hw_layer/{ => adc}/mcp3208.c (100%) rename firmware/hw_layer/{ => adc}/mcp3208.h (100%) rename firmware/hw_layer/{ => digital_input}/digital_input.cpp (100%) rename firmware/hw_layer/{ => digital_input}/digital_input.h (100%) rename firmware/hw_layer/{ => digital_input}/digital_input_exti.cpp (100%) rename firmware/hw_layer/{ => digital_input}/digital_input_exti.h (100%) rename firmware/hw_layer/{ => digital_input}/digital_input_icu.cpp (100%) rename firmware/hw_layer/{ => digital_input}/digital_input_icu.h (100%) rename firmware/hw_layer/{ => digital_input/trigger}/trigger_input.cpp (100%) rename firmware/hw_layer/{ => digital_input/trigger}/trigger_input.h (100%) rename firmware/hw_layer/{ => digital_input/trigger}/trigger_input_comp.cpp (100%) rename firmware/hw_layer/{ => digital_input/trigger}/trigger_input_exti.cpp (100%) rename firmware/hw_layer/{ => digital_input/trigger}/trigger_input_icu.cpp (100%) rename firmware/hw_layer/{ => sensors}/hip9011.cpp (100%) rename firmware/hw_layer/{ => sensors}/hip9011.h (100%) rename firmware/hw_layer/{ => sensors}/hip9011_logic.cpp (100%) rename firmware/hw_layer/{ => sensors}/hip9011_logic.h (100%) diff --git a/firmware/Makefile b/firmware/Makefile index f0d7e97c6a..0ccdc594e2 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -296,8 +296,8 @@ INCDIR = $(CHIBIOS)/os/license \ ext_algo \ console_util \ $(CONSOLE_INC) \ - $(PROJECT_DIR)/hw_layer \ - $(PROJECT_DIR)/mass_storage \ + $(HW_LAYER_INC) \ + $(PROJECT_DIR)/hw_layer/mass_storage \ $(PROJECT_DIR)/hw_layer/serial_over_usb \ $(PROJECT_DIR)/hw_layer/algo \ $(PROJECT_DIR)/hw_layer/lcd \ diff --git a/firmware/hw_layer/AdcConfiguration.h b/firmware/hw_layer/adc/AdcConfiguration.h similarity index 100% rename from firmware/hw_layer/AdcConfiguration.h rename to firmware/hw_layer/adc/AdcConfiguration.h diff --git a/firmware/hw_layer/adc_external.h b/firmware/hw_layer/adc/adc_external.h similarity index 100% rename from firmware/hw_layer/adc_external.h rename to firmware/hw_layer/adc/adc_external.h diff --git a/firmware/hw_layer/adc_inputs.cpp b/firmware/hw_layer/adc/adc_inputs.cpp similarity index 100% rename from firmware/hw_layer/adc_inputs.cpp rename to firmware/hw_layer/adc/adc_inputs.cpp diff --git a/firmware/hw_layer/adc_inputs.h b/firmware/hw_layer/adc/adc_inputs.h similarity index 100% rename from firmware/hw_layer/adc_inputs.h rename to firmware/hw_layer/adc/adc_inputs.h diff --git a/firmware/hw_layer/adc_subscription.cpp b/firmware/hw_layer/adc/adc_subscription.cpp similarity index 100% rename from firmware/hw_layer/adc_subscription.cpp rename to firmware/hw_layer/adc/adc_subscription.cpp diff --git a/firmware/hw_layer/adc_subscription.h b/firmware/hw_layer/adc/adc_subscription.h similarity index 100% rename from firmware/hw_layer/adc_subscription.h rename to firmware/hw_layer/adc/adc_subscription.h diff --git a/firmware/hw_layer/mcp3208.c b/firmware/hw_layer/adc/mcp3208.c similarity index 100% rename from firmware/hw_layer/mcp3208.c rename to firmware/hw_layer/adc/mcp3208.c diff --git a/firmware/hw_layer/mcp3208.h b/firmware/hw_layer/adc/mcp3208.h similarity index 100% rename from firmware/hw_layer/mcp3208.h rename to firmware/hw_layer/adc/mcp3208.h diff --git a/firmware/hw_layer/digital_input.cpp b/firmware/hw_layer/digital_input/digital_input.cpp similarity index 100% rename from firmware/hw_layer/digital_input.cpp rename to firmware/hw_layer/digital_input/digital_input.cpp diff --git a/firmware/hw_layer/digital_input.h b/firmware/hw_layer/digital_input/digital_input.h similarity index 100% rename from firmware/hw_layer/digital_input.h rename to firmware/hw_layer/digital_input/digital_input.h diff --git a/firmware/hw_layer/digital_input_exti.cpp b/firmware/hw_layer/digital_input/digital_input_exti.cpp similarity index 100% rename from firmware/hw_layer/digital_input_exti.cpp rename to firmware/hw_layer/digital_input/digital_input_exti.cpp diff --git a/firmware/hw_layer/digital_input_exti.h b/firmware/hw_layer/digital_input/digital_input_exti.h similarity index 100% rename from firmware/hw_layer/digital_input_exti.h rename to firmware/hw_layer/digital_input/digital_input_exti.h diff --git a/firmware/hw_layer/digital_input_icu.cpp b/firmware/hw_layer/digital_input/digital_input_icu.cpp similarity index 100% rename from firmware/hw_layer/digital_input_icu.cpp rename to firmware/hw_layer/digital_input/digital_input_icu.cpp diff --git a/firmware/hw_layer/digital_input_icu.h b/firmware/hw_layer/digital_input/digital_input_icu.h similarity index 100% rename from firmware/hw_layer/digital_input_icu.h rename to firmware/hw_layer/digital_input/digital_input_icu.h diff --git a/firmware/hw_layer/trigger_input.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input.cpp similarity index 100% rename from firmware/hw_layer/trigger_input.cpp rename to firmware/hw_layer/digital_input/trigger/trigger_input.cpp diff --git a/firmware/hw_layer/trigger_input.h b/firmware/hw_layer/digital_input/trigger/trigger_input.h similarity index 100% rename from firmware/hw_layer/trigger_input.h rename to firmware/hw_layer/digital_input/trigger/trigger_input.h diff --git a/firmware/hw_layer/trigger_input_comp.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input_comp.cpp similarity index 100% rename from firmware/hw_layer/trigger_input_comp.cpp rename to firmware/hw_layer/digital_input/trigger/trigger_input_comp.cpp diff --git a/firmware/hw_layer/trigger_input_exti.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input_exti.cpp similarity index 100% rename from firmware/hw_layer/trigger_input_exti.cpp rename to firmware/hw_layer/digital_input/trigger/trigger_input_exti.cpp diff --git a/firmware/hw_layer/trigger_input_icu.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input_icu.cpp similarity index 100% rename from firmware/hw_layer/trigger_input_icu.cpp rename to firmware/hw_layer/digital_input/trigger/trigger_input_icu.cpp diff --git a/firmware/hw_layer/hw_layer.mk b/firmware/hw_layer/hw_layer.mk index ada8b876c0..ff6317c0aa 100644 --- a/firmware/hw_layer/hw_layer.mk +++ b/firmware/hw_layer/hw_layer.mk @@ -1,6 +1,10 @@ HW_LAYER_EGT = $(PROJECT_DIR)/hw_layer/serial_over_usb/usbcfg.c \ $(PROJECT_DIR)/hw_layer/serial_over_usb/usbconsole.c +HW_LAYER_INC= $(PROJECT_DIR)/hw_layer $(PROJECT_DIR)/hw_layer/adc \ + $(PROJECT_DIR)/hw_layer/digital_input \ + $(PROJECT_DIR)/hw_layer/digital_input/trigger + HW_INC = hw_layer/$(CPU_HWLAYER) \ $(PROJECT_DIR)/hw_layer/ports @@ -8,28 +12,28 @@ HW_LAYER_EGT_CPP = \ $(PROJECT_DIR)/hw_layer/max31855.cpp HW_LAYER_EMS = $(HW_LAYER_EGT) \ - $(PROJECT_DIR)/hw_layer/mcp3208.c \ - $(PROJECT_DIR)/hw_layer/mc33816_data.c \ + $(PROJECT_DIR)/hw_layer/adc/mcp3208.c \ + $(PROJECT_DIR)/hw_layer/mc33816_data.c HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \ $(PROJECT_DIR)/hw_layer/pin_repository.cpp \ $(PROJECT_DIR)/hw_layer/microsecond_timer.cpp \ - $(PROJECT_DIR)/hw_layer/digital_input.cpp \ - $(PROJECT_DIR)/hw_layer/digital_input_icu.cpp \ - $(PROJECT_DIR)/hw_layer/digital_input_exti.cpp \ + $(PROJECT_DIR)/hw_layer/digital_input/digital_input.cpp \ + $(PROJECT_DIR)/hw_layer/digital_input/digital_input_icu.cpp \ + $(PROJECT_DIR)/hw_layer/digital_input/digital_input_exti.cpp \ + $(PROJECT_DIR)/hw_layer/digital_input/trigger/trigger_input.cpp \ + $(PROJECT_DIR)/hw_layer/digital_input/trigger/trigger_input_icu.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/lcd/lcd_HD44780.cpp \ - $(PROJECT_DIR)/hw_layer/adc_inputs.cpp \ - $(PROJECT_DIR)/hw_layer/adc_subscription.cpp \ - $(PROJECT_DIR)/hw_layer/trigger_input.cpp \ - $(PROJECT_DIR)/hw_layer/trigger_input_icu.cpp \ - $(PROJECT_DIR)/hw_layer/trigger_input_exti.cpp \ - $(PROJECT_DIR)/hw_layer/hip9011.cpp \ + $(PROJECT_DIR)/hw_layer/adc/adc_inputs.cpp \ + $(PROJECT_DIR)/hw_layer/adc/adc_subscription.cpp \ + $(PROJECT_DIR)/hw_layer/sensors/hip9011.cpp \ + $(PROJECT_DIR)/hw_layer/sensors/hip9011_logic.cpp \ $(PROJECT_DIR)/hw_layer/mc33816.cpp \ - $(PROJECT_DIR)/hw_layer/hip9011_logic.cpp \ $(PROJECT_DIR)/hw_layer/vehicle_speed.cpp \ $(PROJECT_DIR)/hw_layer/stepper.cpp \ $(PROJECT_DIR)/hw_layer/stepper_dual_hbridge.cpp \ @@ -37,7 +41,7 @@ HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \ $(PROJECT_DIR)/hw_layer/io_pins.cpp \ $(PROJECT_DIR)/hw_layer/rtc_helper.cpp \ $(PROJECT_DIR)/hw_layer/cdm_ion_sense.cpp \ - $(PROJECT_DIR)/hw_layer/backup_ram.cpp \ + $(PROJECT_DIR)/hw_layer/backup_ram.cpp # # '-include' is a magic kind of 'include' which would survive if file to be included is not found diff --git a/firmware/hw_layer/hip9011.cpp b/firmware/hw_layer/sensors/hip9011.cpp similarity index 100% rename from firmware/hw_layer/hip9011.cpp rename to firmware/hw_layer/sensors/hip9011.cpp diff --git a/firmware/hw_layer/hip9011.h b/firmware/hw_layer/sensors/hip9011.h similarity index 100% rename from firmware/hw_layer/hip9011.h rename to firmware/hw_layer/sensors/hip9011.h diff --git a/firmware/hw_layer/hip9011_logic.cpp b/firmware/hw_layer/sensors/hip9011_logic.cpp similarity index 100% rename from firmware/hw_layer/hip9011_logic.cpp rename to firmware/hw_layer/sensors/hip9011_logic.cpp diff --git a/firmware/hw_layer/hip9011_logic.h b/firmware/hw_layer/sensors/hip9011_logic.h similarity index 100% rename from firmware/hw_layer/hip9011_logic.h rename to firmware/hw_layer/sensors/hip9011_logic.h diff --git a/simulator/Makefile b/simulator/Makefile index 71eea1e812..6a289cc2e5 100644 --- a/simulator/Makefile +++ b/simulator/Makefile @@ -196,7 +196,7 @@ INCDIR = . \ $(PROJECT_DIR)/config/engines \ $(PROJECT_DIR)/ext_algo \ $(HW_LAYER_DRIVERS_INC) \ - $(PROJECT_DIR)/hw_layer \ + $(HW_LAYER_INC) $(HW_SENSORS_INC) \ $(PROJECT_DIR)/hw_layer/algo \ $(PROJECT_DIR)/hw_layer/drivers/can \ $(HW_SENSORS_INC) \ diff --git a/unit_tests/Makefile b/unit_tests/Makefile index c1f3596319..58f500a30f 100644 --- a/unit_tests/Makefile +++ b/unit_tests/Makefile @@ -179,9 +179,8 @@ INCDIR = . \ $(CONSOLE_INC) \ $(DEVELOPMENT_DIR) \ $(PROJECT_DIR)/ext_algo \ - $(PROJECT_DIR)/hw_layer \ + $(HW_LAYER_INC) \ $(PROJECT_DIR)/hw_layer/algo \ - $(PROJECT_DIR)/hw_layer/sensors/ \ $(PROJECT_DIR)/init/ \ $(HW_LAYER_DRIVERS_INC) \ test_data_structures \