diff --git a/appconf/appconf_default.h b/applications/appconf_default.h similarity index 100% rename from appconf/appconf_default.h rename to applications/appconf_default.h diff --git a/comm/comm.mk b/comm/comm.mk new file mode 100644 index 00000000..898ed060 --- /dev/null +++ b/comm/comm.mk @@ -0,0 +1,9 @@ +CSRC += \ + comm/commands.c \ + comm/comm_usb_serial.c \ + comm/comm_usb.c \ + comm/comm_can.c \ + comm/packet.c + +INCDIR += comm + diff --git a/comm_can.c b/comm/comm_can.c similarity index 100% rename from comm_can.c rename to comm/comm_can.c diff --git a/comm_can.h b/comm/comm_can.h similarity index 100% rename from comm_can.h rename to comm/comm_can.h diff --git a/comm_usb.c b/comm/comm_usb.c similarity index 100% rename from comm_usb.c rename to comm/comm_usb.c diff --git a/comm_usb.h b/comm/comm_usb.h similarity index 100% rename from comm_usb.h rename to comm/comm_usb.h diff --git a/comm_usb_serial.c b/comm/comm_usb_serial.c similarity index 100% rename from comm_usb_serial.c rename to comm/comm_usb_serial.c diff --git a/comm_usb_serial.h b/comm/comm_usb_serial.h similarity index 100% rename from comm_usb_serial.h rename to comm/comm_usb_serial.h diff --git a/commands.c b/comm/commands.c similarity index 100% rename from commands.c rename to comm/commands.c diff --git a/commands.h b/comm/commands.h similarity index 100% rename from commands.h rename to comm/commands.h diff --git a/packet.c b/comm/packet.c similarity index 100% rename from packet.c rename to comm/packet.c diff --git a/packet.h b/comm/packet.h similarity index 100% rename from packet.h rename to comm/packet.h diff --git a/driver/driver.mk b/driver/driver.mk new file mode 100644 index 00000000..4fa853dd --- /dev/null +++ b/driver/driver.mk @@ -0,0 +1,25 @@ +CSRC += \ + driver/eeprom.c \ + driver/i2c_bb.c \ + driver/ledpwm.c \ + driver/servo_dec.c \ + driver/servo_simple.c \ + driver/spi_bb.c \ + driver/timer.c + +CSRC += \ + driver/lora/SX1278.c \ + driver/lora/lora.c \ + driver/lora/SX1278_hw.c + +CSRC += \ + driver/nrf/spi_sw.c \ + driver/nrf/rf.c \ + driver/nrf/rfhelp.c \ + driver/nrf/nrf_driver.c + +INCDIR += \ + driver \ + driver/lora \ + driver/nrf + diff --git a/eeprom.c b/driver/eeprom.c similarity index 100% rename from eeprom.c rename to driver/eeprom.c diff --git a/eeprom.h b/driver/eeprom.h similarity index 100% rename from eeprom.h rename to driver/eeprom.h diff --git a/i2c_bb.c b/driver/i2c_bb.c similarity index 100% rename from i2c_bb.c rename to driver/i2c_bb.c diff --git a/i2c_bb.h b/driver/i2c_bb.h similarity index 100% rename from i2c_bb.h rename to driver/i2c_bb.h diff --git a/ledpwm.c b/driver/ledpwm.c similarity index 100% rename from ledpwm.c rename to driver/ledpwm.c diff --git a/ledpwm.h b/driver/ledpwm.h similarity index 100% rename from ledpwm.h rename to driver/ledpwm.h diff --git a/lora/SX1278.c b/driver/lora/SX1278.c similarity index 100% rename from lora/SX1278.c rename to driver/lora/SX1278.c diff --git a/lora/SX1278.h b/driver/lora/SX1278.h similarity index 100% rename from lora/SX1278.h rename to driver/lora/SX1278.h diff --git a/lora/SX1278_hw.c b/driver/lora/SX1278_hw.c similarity index 100% rename from lora/SX1278_hw.c rename to driver/lora/SX1278_hw.c diff --git a/lora/SX1278_hw.h b/driver/lora/SX1278_hw.h similarity index 100% rename from lora/SX1278_hw.h rename to driver/lora/SX1278_hw.h diff --git a/lora/lora.c b/driver/lora/lora.c similarity index 100% rename from lora/lora.c rename to driver/lora/lora.c diff --git a/lora/lora.h b/driver/lora/lora.h similarity index 100% rename from lora/lora.h rename to driver/lora/lora.h diff --git a/nrf/nrf_driver.c b/driver/nrf/nrf_driver.c similarity index 100% rename from nrf/nrf_driver.c rename to driver/nrf/nrf_driver.c diff --git a/nrf/nrf_driver.h b/driver/nrf/nrf_driver.h similarity index 100% rename from nrf/nrf_driver.h rename to driver/nrf/nrf_driver.h diff --git a/nrf/rf.c b/driver/nrf/rf.c similarity index 100% rename from nrf/rf.c rename to driver/nrf/rf.c diff --git a/nrf/rf.h b/driver/nrf/rf.h similarity index 100% rename from nrf/rf.h rename to driver/nrf/rf.h diff --git a/nrf/rfhelp.c b/driver/nrf/rfhelp.c similarity index 100% rename from nrf/rfhelp.c rename to driver/nrf/rfhelp.c diff --git a/nrf/rfhelp.h b/driver/nrf/rfhelp.h similarity index 100% rename from nrf/rfhelp.h rename to driver/nrf/rfhelp.h diff --git a/nrf/spi_sw.c b/driver/nrf/spi_sw.c similarity index 100% rename from nrf/spi_sw.c rename to driver/nrf/spi_sw.c diff --git a/nrf/spi_sw.h b/driver/nrf/spi_sw.h similarity index 100% rename from nrf/spi_sw.h rename to driver/nrf/spi_sw.h diff --git a/servo_dec.c b/driver/servo_dec.c similarity index 100% rename from servo_dec.c rename to driver/servo_dec.c diff --git a/servo_dec.h b/driver/servo_dec.h similarity index 100% rename from servo_dec.h rename to driver/servo_dec.h diff --git a/servo_simple.c b/driver/servo_simple.c similarity index 100% rename from servo_simple.c rename to driver/servo_simple.c diff --git a/servo_simple.h b/driver/servo_simple.h similarity index 100% rename from servo_simple.h rename to driver/servo_simple.h diff --git a/spi_bb.c b/driver/spi_bb.c similarity index 100% rename from spi_bb.c rename to driver/spi_bb.c diff --git a/spi_bb.h b/driver/spi_bb.h similarity index 100% rename from spi_bb.h rename to driver/spi_bb.h diff --git a/timer.c b/driver/timer.c similarity index 100% rename from timer.c rename to driver/timer.c diff --git a/timer.h b/driver/timer.h similarity index 100% rename from timer.h rename to driver/timer.h diff --git a/board.c b/hwconf/board.c similarity index 100% rename from board.c rename to hwconf/board.c diff --git a/board.h b/hwconf/board.h similarity index 100% rename from board.h rename to hwconf/board.h diff --git a/hwconf/hwconf.mk b/hwconf/hwconf.mk index 67624b74..24ebd980 100644 --- a/hwconf/hwconf.mk +++ b/hwconf/hwconf.mk @@ -1,10 +1,13 @@ -HWSRC = hwconf/hw.c \ +HWSRC = \ + hwconf/board.c \ + hwconf/hw.c \ hwconf/drv8301.c \ hwconf/drv8305.c \ hwconf/drv8320s.c \ hwconf/drv8323s.c \ hwconf/luna/luna_display_serial.c \ - hwconf/si8900.c + hwconf/si8900.c \ + hwconf/shutdown.c \ HWINC = hwconf \ hwconf/luna diff --git a/mcuconf.h b/hwconf/mcuconf.h similarity index 100% rename from mcuconf.h rename to hwconf/mcuconf.h diff --git a/hwconf/hw_Cheap_FOCer_2.c b/hwconf/other/hw_Cheap_FOCer_2.c similarity index 100% rename from hwconf/hw_Cheap_FOCer_2.c rename to hwconf/other/hw_Cheap_FOCer_2.c diff --git a/hwconf/hw_Cheap_FOCer_2.h b/hwconf/other/hw_Cheap_FOCer_2.h similarity index 100% rename from hwconf/hw_Cheap_FOCer_2.h rename to hwconf/other/hw_Cheap_FOCer_2.h diff --git a/hwconf/hw_Little_FOCer.c b/hwconf/other/hw_Little_FOCer.c similarity index 100% rename from hwconf/hw_Little_FOCer.c rename to hwconf/other/hw_Little_FOCer.c diff --git a/hwconf/hw_Little_FOCer.h b/hwconf/other/hw_Little_FOCer.h similarity index 100% rename from hwconf/hw_Little_FOCer.h rename to hwconf/other/hw_Little_FOCer.h diff --git a/hwconf/hw_Little_FOCer_no_limits.h b/hwconf/other/hw_Little_FOCer_no_limits.h similarity index 100% rename from hwconf/hw_Little_FOCer_no_limits.h rename to hwconf/other/hw_Little_FOCer_no_limits.h diff --git a/hwconf/hw_axiom.c b/hwconf/other/hw_axiom.c similarity index 100% rename from hwconf/hw_axiom.c rename to hwconf/other/hw_axiom.c diff --git a/hwconf/hw_axiom.h b/hwconf/other/hw_axiom.h similarity index 100% rename from hwconf/hw_axiom.h rename to hwconf/other/hw_axiom.h diff --git a/hwconf/hw_axiom_fpga_bitstream.c b/hwconf/other/hw_axiom_fpga_bitstream.c similarity index 100% rename from hwconf/hw_axiom_fpga_bitstream.c rename to hwconf/other/hw_axiom_fpga_bitstream.c diff --git a/hwconf/hw_das_mini.c b/hwconf/other/hw_das_mini.c similarity index 100% rename from hwconf/hw_das_mini.c rename to hwconf/other/hw_das_mini.c diff --git a/hwconf/hw_das_mini.h b/hwconf/other/hw_das_mini.h similarity index 100% rename from hwconf/hw_das_mini.h rename to hwconf/other/hw_das_mini.h diff --git a/hwconf/hw_das_rs.c b/hwconf/other/hw_das_rs.c similarity index 100% rename from hwconf/hw_das_rs.c rename to hwconf/other/hw_das_rs.c diff --git a/hwconf/hw_das_rs.h b/hwconf/other/hw_das_rs.h similarity index 100% rename from hwconf/hw_das_rs.h rename to hwconf/other/hw_das_rs.h diff --git a/hwconf/hw_es19.c b/hwconf/other/hw_es19.c similarity index 100% rename from hwconf/hw_es19.c rename to hwconf/other/hw_es19.c diff --git a/hwconf/hw_es19.h b/hwconf/other/hw_es19.h similarity index 100% rename from hwconf/hw_es19.h rename to hwconf/other/hw_es19.h diff --git a/hwconf/hw_gesc.c b/hwconf/other/hw_gesc.c similarity index 100% rename from hwconf/hw_gesc.c rename to hwconf/other/hw_gesc.c diff --git a/hwconf/hw_gesc.h b/hwconf/other/hw_gesc.h similarity index 100% rename from hwconf/hw_gesc.h rename to hwconf/other/hw_gesc.h diff --git a/hwconf/hw_mini4.c b/hwconf/other/hw_mini4.c similarity index 100% rename from hwconf/hw_mini4.c rename to hwconf/other/hw_mini4.c diff --git a/hwconf/hw_mini4.h b/hwconf/other/hw_mini4.h similarity index 100% rename from hwconf/hw_mini4.h rename to hwconf/other/hw_mini4.h diff --git a/hwconf/hw_r2.c b/hwconf/other/hw_r2.c similarity index 100% rename from hwconf/hw_r2.c rename to hwconf/other/hw_r2.c diff --git a/hwconf/hw_r2.h b/hwconf/other/hw_r2.h similarity index 100% rename from hwconf/hw_r2.h rename to hwconf/other/hw_r2.h diff --git a/hwconf/hw_raiden7.c b/hwconf/other/hw_raiden7.c similarity index 100% rename from hwconf/hw_raiden7.c rename to hwconf/other/hw_raiden7.c diff --git a/hwconf/hw_raiden7.h b/hwconf/other/hw_raiden7.h similarity index 100% rename from hwconf/hw_raiden7.h rename to hwconf/other/hw_raiden7.h diff --git a/hwconf/hw_rd2.c b/hwconf/other/hw_rd2.c similarity index 100% rename from hwconf/hw_rd2.c rename to hwconf/other/hw_rd2.c diff --git a/hwconf/hw_rd2.h b/hwconf/other/hw_rd2.h similarity index 100% rename from hwconf/hw_rd2.h rename to hwconf/other/hw_rd2.h diff --git a/hwconf/hw_resc.c b/hwconf/other/hw_resc.c similarity index 100% rename from hwconf/hw_resc.c rename to hwconf/other/hw_resc.c diff --git a/hwconf/hw_resc.h b/hwconf/other/hw_resc.h similarity index 100% rename from hwconf/hw_resc.h rename to hwconf/other/hw_resc.h diff --git a/hwconf/hw_rh.c b/hwconf/other/hw_rh.c similarity index 100% rename from hwconf/hw_rh.c rename to hwconf/other/hw_rh.c diff --git a/hwconf/hw_rh.h b/hwconf/other/hw_rh.h similarity index 100% rename from hwconf/hw_rh.h rename to hwconf/other/hw_rh.h diff --git a/hwconf/hw_uavc_omega.c b/hwconf/other/hw_uavc_omega.c similarity index 100% rename from hwconf/hw_uavc_omega.c rename to hwconf/other/hw_uavc_omega.c diff --git a/hwconf/hw_uavc_omega.h b/hwconf/other/hw_uavc_omega.h similarity index 100% rename from hwconf/hw_uavc_omega.h rename to hwconf/other/hw_uavc_omega.h diff --git a/hwconf/hw_uavc_qcube.c b/hwconf/other/hw_uavc_qcube.c similarity index 100% rename from hwconf/hw_uavc_qcube.c rename to hwconf/other/hw_uavc_qcube.c diff --git a/hwconf/hw_uavc_qcube.h b/hwconf/other/hw_uavc_qcube.h similarity index 100% rename from hwconf/hw_uavc_qcube.h rename to hwconf/other/hw_uavc_qcube.h diff --git a/hwconf/hw_ubox_single.c b/hwconf/other/hw_ubox_single.c similarity index 100% rename from hwconf/hw_ubox_single.c rename to hwconf/other/hw_ubox_single.c diff --git a/hwconf/hw_ubox_single.h b/hwconf/other/hw_ubox_single.h similarity index 100% rename from hwconf/hw_ubox_single.h rename to hwconf/other/hw_ubox_single.h diff --git a/hwconf/hw_unity.c b/hwconf/other/hw_unity.c similarity index 100% rename from hwconf/hw_unity.c rename to hwconf/other/hw_unity.c diff --git a/hwconf/hw_unity.h b/hwconf/other/hw_unity.h similarity index 100% rename from hwconf/hw_unity.h rename to hwconf/other/hw_unity.h diff --git a/hwconf/hw_unity_no_limits.h b/hwconf/other/hw_unity_no_limits.h similarity index 100% rename from hwconf/hw_unity_no_limits.h rename to hwconf/other/hw_unity_no_limits.h diff --git a/hwconf/hw_uxv_sr.c b/hwconf/other/hw_uxv_sr.c similarity index 100% rename from hwconf/hw_uxv_sr.c rename to hwconf/other/hw_uxv_sr.c diff --git a/hwconf/hw_uxv_sr.h b/hwconf/other/hw_uxv_sr.h similarity index 100% rename from hwconf/hw_uxv_sr.h rename to hwconf/other/hw_uxv_sr.h diff --git a/hwconf/hw_warrior6.c b/hwconf/other/hw_warrior6.c similarity index 100% rename from hwconf/hw_warrior6.c rename to hwconf/other/hw_warrior6.c diff --git a/hwconf/hw_warrior6.h b/hwconf/other/hw_warrior6.h similarity index 100% rename from hwconf/hw_warrior6.h rename to hwconf/other/hw_warrior6.h diff --git a/hwconf/trampa/vesc4/hw_40.c b/hwconf/other/vesc4/hw_40.c similarity index 100% rename from hwconf/trampa/vesc4/hw_40.c rename to hwconf/other/vesc4/hw_40.c diff --git a/hwconf/trampa/vesc4/hw_40.h b/hwconf/other/vesc4/hw_40.h similarity index 100% rename from hwconf/trampa/vesc4/hw_40.h rename to hwconf/other/vesc4/hw_40.h diff --git a/hwconf/trampa/vesc4/hw_410.c b/hwconf/other/vesc4/hw_410.c similarity index 100% rename from hwconf/trampa/vesc4/hw_410.c rename to hwconf/other/vesc4/hw_410.c diff --git a/hwconf/trampa/vesc4/hw_410.h b/hwconf/other/vesc4/hw_410.h similarity index 100% rename from hwconf/trampa/vesc4/hw_410.h rename to hwconf/other/vesc4/hw_410.h diff --git a/hwconf/trampa/vesc4/hw_410_0005ohm.h b/hwconf/other/vesc4/hw_410_0005ohm.h similarity index 94% rename from hwconf/trampa/vesc4/hw_410_0005ohm.h rename to hwconf/other/vesc4/hw_410_0005ohm.h index eb6ba67c..e30d66b9 100644 --- a/hwconf/trampa/vesc4/hw_410_0005ohm.h +++ b/hwconf/other/vesc4/hw_410_0005ohm.h @@ -18,7 +18,7 @@ #ifndef HW_410_0005OHM_H_ #define HW_410_0005OHM_H_ -#define HW_SOURCE_ALT "trampa/vesc4/hw_410.c" +#define HW_SOURCE_ALT "other/vesc4/hw_410.c" #define CURRENT_SHUNT_RES 0.0005 #include "hw_410.h" diff --git a/hwconf/trampa/vesc4/hw_410_005ohm.h b/hwconf/other/vesc4/hw_410_005ohm.h similarity index 94% rename from hwconf/trampa/vesc4/hw_410_005ohm.h rename to hwconf/other/vesc4/hw_410_005ohm.h index 5de654be..54ab3d2e 100644 --- a/hwconf/trampa/vesc4/hw_410_005ohm.h +++ b/hwconf/other/vesc4/hw_410_005ohm.h @@ -18,7 +18,7 @@ #ifndef HW_410_005OHM_H_ #define HW_410_005OHM_H_ -#define HW_SOURCE_ALT "trampa/vesc4/hw_410.c" +#define HW_SOURCE_ALT "other/vesc4/hw_410.c" #define CURRENT_SHUNT_RES 0.005 #include "hw_410.h" diff --git a/hwconf/trampa/vesc4/hw_410_no_limits.h b/hwconf/other/vesc4/hw_410_no_limits.h similarity index 100% rename from hwconf/trampa/vesc4/hw_410_no_limits.h rename to hwconf/other/vesc4/hw_410_no_limits.h diff --git a/hwconf/trampa/vesc4/hw_45.c b/hwconf/other/vesc4/hw_45.c similarity index 100% rename from hwconf/trampa/vesc4/hw_45.c rename to hwconf/other/vesc4/hw_45.c diff --git a/hwconf/trampa/vesc4/hw_45.h b/hwconf/other/vesc4/hw_45.h similarity index 100% rename from hwconf/trampa/vesc4/hw_45.h rename to hwconf/other/vesc4/hw_45.h diff --git a/hwconf/trampa/vesc4/hw_46.c b/hwconf/other/vesc4/hw_46.c similarity index 100% rename from hwconf/trampa/vesc4/hw_46.c rename to hwconf/other/vesc4/hw_46.c diff --git a/hwconf/trampa/vesc4/hw_46.h b/hwconf/other/vesc4/hw_46.h similarity index 100% rename from hwconf/trampa/vesc4/hw_46.h rename to hwconf/other/vesc4/hw_46.h diff --git a/hwconf/trampa/vesc4/hw_46_0005ohm.h b/hwconf/other/vesc4/hw_46_0005ohm.h similarity index 94% rename from hwconf/trampa/vesc4/hw_46_0005ohm.h rename to hwconf/other/vesc4/hw_46_0005ohm.h index 0ead9310..e2af6836 100644 --- a/hwconf/trampa/vesc4/hw_46_0005ohm.h +++ b/hwconf/other/vesc4/hw_46_0005ohm.h @@ -18,7 +18,7 @@ #ifndef HW_46_0005OHM_H_ #define HW_46_0005OHM_H_ -#define HW_SOURCE_ALT "trampa/vesc4/hw_46.c" +#define HW_SOURCE_ALT "other/vesc4/hw_46.c" #define CURRENT_SHUNT_RES 0.0005 #include "hw_46.h" diff --git a/hwconf/trampa/vesc4/hw_46_33k.h b/hwconf/other/vesc4/hw_46_33k.h similarity index 94% rename from hwconf/trampa/vesc4/hw_46_33k.h rename to hwconf/other/vesc4/hw_46_33k.h index 1f3d30e9..bf915ab3 100644 --- a/hwconf/trampa/vesc4/hw_46_33k.h +++ b/hwconf/other/vesc4/hw_46_33k.h @@ -18,7 +18,7 @@ #ifndef HW_46_33K_H_ #define HW_46_33K_H_ -#define HW_SOURCE_ALT "trampa/vesc4/hw_46.c" +#define HW_SOURCE_ALT "other/vesc4/hw_46.c" #define VIN_R1 33000.0 #include "hw_46.h" diff --git a/hwconf/trampa/vesc4/hw_48.c b/hwconf/other/vesc4/hw_48.c similarity index 100% rename from hwconf/trampa/vesc4/hw_48.c rename to hwconf/other/vesc4/hw_48.c diff --git a/hwconf/trampa/vesc4/hw_48.h b/hwconf/other/vesc4/hw_48.h similarity index 100% rename from hwconf/trampa/vesc4/hw_48.h rename to hwconf/other/vesc4/hw_48.h diff --git a/hwconf/trampa/vesc4/hw_49.c b/hwconf/other/vesc4/hw_49.c similarity index 100% rename from hwconf/trampa/vesc4/hw_49.c rename to hwconf/other/vesc4/hw_49.c diff --git a/hwconf/trampa/vesc4/hw_49.h b/hwconf/other/vesc4/hw_49.h similarity index 100% rename from hwconf/trampa/vesc4/hw_49.h rename to hwconf/other/vesc4/hw_49.h diff --git a/shutdown.c b/hwconf/shutdown.c similarity index 99% rename from shutdown.c rename to hwconf/shutdown.c index 0467e5cb..49db94b1 100644 --- a/shutdown.c +++ b/hwconf/shutdown.c @@ -62,7 +62,7 @@ void shutdown_set_sampling_disabled(bool disabled) { chMtxUnlock(&m_sample_mutex); } -bool do_shutdown(void) { +static bool do_shutdown(void) { conf_general_store_backup_data(); DISABLE_GATE(); HW_SHUTDOWN_HOLD_OFF(); diff --git a/shutdown.h b/hwconf/shutdown.h similarity index 100% rename from shutdown.h rename to hwconf/shutdown.h diff --git a/stm32f4xx_conf.h b/hwconf/stm32f4xx_conf.h similarity index 100% rename from stm32f4xx_conf.h rename to hwconf/stm32f4xx_conf.h diff --git a/hwconf/hw_100_250.c b/hwconf/trampa/100_250/hw_100_250.c similarity index 100% rename from hwconf/hw_100_250.c rename to hwconf/trampa/100_250/hw_100_250.c diff --git a/hwconf/hw_100_250.h b/hwconf/trampa/100_250/hw_100_250.h similarity index 100% rename from hwconf/hw_100_250.h rename to hwconf/trampa/100_250/hw_100_250.h diff --git a/hwconf/hw_100_250_no_limits.h b/hwconf/trampa/100_250/hw_100_250_no_limits.h similarity index 100% rename from hwconf/hw_100_250_no_limits.h rename to hwconf/trampa/100_250/hw_100_250_no_limits.h diff --git a/hwconf/hw_140_300.c b/hwconf/trampa/140_300/hw_140_300.c similarity index 100% rename from hwconf/hw_140_300.c rename to hwconf/trampa/140_300/hw_140_300.c diff --git a/hwconf/hw_140_300.h b/hwconf/trampa/140_300/hw_140_300.h similarity index 100% rename from hwconf/hw_140_300.h rename to hwconf/trampa/140_300/hw_140_300.h diff --git a/hwconf/hw_hd60.c b/hwconf/trampa/hd/hw_hd60.c similarity index 100% rename from hwconf/hw_hd60.c rename to hwconf/trampa/hd/hw_hd60.c diff --git a/hwconf/hw_hd60.h b/hwconf/trampa/hd/hw_hd60.h similarity index 100% rename from hwconf/hw_hd60.h rename to hwconf/trampa/hd/hw_hd60.h diff --git a/hwconf/hw_hd60_no_limits.h b/hwconf/trampa/hd/hw_hd60_no_limits.h similarity index 100% rename from hwconf/hw_hd60_no_limits.h rename to hwconf/trampa/hd/hw_hd60_no_limits.h diff --git a/hwconf/hw_hd75.c b/hwconf/trampa/hd/hw_hd75.c similarity index 100% rename from hwconf/hw_hd75.c rename to hwconf/trampa/hd/hw_hd75.c diff --git a/hwconf/hw_hd75.h b/hwconf/trampa/hd/hw_hd75.h similarity index 100% rename from hwconf/hw_hd75.h rename to hwconf/trampa/hd/hw_hd75.h diff --git a/hwconf/hw_hd75_no_limits.h b/hwconf/trampa/hd/hw_hd75_no_limits.h similarity index 100% rename from hwconf/hw_hd75_no_limits.h rename to hwconf/trampa/hd/hw_hd75_no_limits.h diff --git a/lora/lora.mk b/lora/lora.mk deleted file mode 100644 index 3e0d9226..00000000 --- a/lora/lora.mk +++ /dev/null @@ -1,5 +0,0 @@ -LORASRC = lora/SX1278.c \ - lora/lora.c \ - lora/SX1278_hw.c - -LORAINC = lora diff --git a/lzo/lzo.mk b/lzo/lzo.mk deleted file mode 100644 index f7b3e950..00000000 --- a/lzo/lzo.mk +++ /dev/null @@ -1,2 +0,0 @@ -LZOSRC = lzo/minilzo.c -LZOINC = lzo diff --git a/make/fw.mk b/make/fw.mk index 5413b192..896ac891 100755 --- a/make/fw.mk +++ b/make/fw.mk @@ -105,11 +105,8 @@ include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk # Other files include hwconf/hwconf.mk include applications/applications.mk -include nrf/nrf.mk include libcanard/canard.mk include imu/imu.mk -include lora/lora.mk -include lzo/lzo.mk include blackmagic/blackmagic.mk include encoder/encoder.mk @@ -131,52 +128,22 @@ CSRC = $(STARTUPSRC) \ $(PLATFORMSRC) \ $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ $(CHIBIOS)/os/various/syscalls.c \ - board.c \ main.c \ - comm_usb_serial.c \ irq_handlers.c \ - buffer.c \ - comm_usb.c \ - crc.c \ - digital_filter.c \ - ledpwm.c \ - mcpwm.c \ - servo_dec.c \ - utils_math.c \ - utils_sys.c \ - servo_simple.c \ - packet.c \ terminal.c \ conf_general.c \ - eeprom.c \ - commands.c \ timeout.c \ - comm_can.c \ flash_helper.c \ - mc_interface.c \ - mcpwm_foc.c \ - gpdrive.c \ confgenerator.c \ - timer.c \ - i2c_bb.c \ - spi_bb.c \ - virtual_motor.c \ - shutdown.c \ - mempools.c \ - worker.c \ bms.c \ events.c \ $(HWSRC) \ $(APPSRC) \ - $(NRFSRC) \ $(CANARDSRC) \ $(IMUSRC) \ - $(LORASRC) \ - $(LZOSRC) \ $(BLACKMAGICSRC) \ qmlui/qmlui.c \ - $(ENCSRC) \ - foc_math.c + $(ENCSRC) ifeq ($(USE_LISPBM),1) CSRC += $(LISPBMSRC) @@ -213,21 +180,21 @@ INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) \ $(CHIBIOS)/os/various \ $(CHIBIOS)/os/hal/lib/streams \ - mcconf \ - appconf \ $(HWINC) \ $(APPINC) \ - $(NRFINC) \ $(CANARDINC) \ $(IMUINC) \ - $(LORAINC) \ - $(LZOINC) \ $(BLACKMAGICINC) \ qmlui \ qmlui/hw \ qmlui/app \ $(ENCINC) +include comm/comm.mk +include motor/motor.mk +include util/util.mk +include driver/driver.mk + ifeq ($(USE_LISPBM),1) INCDIR += $(LISPBMINC) endif diff --git a/foc_math.c b/motor/foc_math.c similarity index 100% rename from foc_math.c rename to motor/foc_math.c diff --git a/foc_math.h b/motor/foc_math.h similarity index 100% rename from foc_math.h rename to motor/foc_math.h diff --git a/gpdrive.c b/motor/gpdrive.c similarity index 100% rename from gpdrive.c rename to motor/gpdrive.c diff --git a/gpdrive.h b/motor/gpdrive.h similarity index 100% rename from gpdrive.h rename to motor/gpdrive.h diff --git a/mc_interface.c b/motor/mc_interface.c similarity index 100% rename from mc_interface.c rename to motor/mc_interface.c diff --git a/mc_interface.h b/motor/mc_interface.h similarity index 100% rename from mc_interface.h rename to motor/mc_interface.h diff --git a/mcconf/mcconf_default.h b/motor/mcconf_default.h similarity index 100% rename from mcconf/mcconf_default.h rename to motor/mcconf_default.h diff --git a/mcpwm.c b/motor/mcpwm.c similarity index 100% rename from mcpwm.c rename to motor/mcpwm.c diff --git a/mcpwm.h b/motor/mcpwm.h similarity index 100% rename from mcpwm.h rename to motor/mcpwm.h diff --git a/mcpwm_foc.c b/motor/mcpwm_foc.c similarity index 100% rename from mcpwm_foc.c rename to motor/mcpwm_foc.c diff --git a/mcpwm_foc.h b/motor/mcpwm_foc.h similarity index 100% rename from mcpwm_foc.h rename to motor/mcpwm_foc.h diff --git a/motor/motor.mk b/motor/motor.mk new file mode 100644 index 00000000..a4a19efa --- /dev/null +++ b/motor/motor.mk @@ -0,0 +1,10 @@ +CSRC += \ + motor/foc_math.c \ + motor/gpdrive.c \ + motor/mc_interface.c \ + motor/mcpwm.c \ + motor/mcpwm_foc.c \ + motor/virtual_motor.c + +INCDIR += motor + diff --git a/virtual_motor.c b/motor/virtual_motor.c similarity index 100% rename from virtual_motor.c rename to motor/virtual_motor.c diff --git a/virtual_motor.h b/motor/virtual_motor.h similarity index 100% rename from virtual_motor.h rename to motor/virtual_motor.h diff --git a/nrf/nrf.mk b/nrf/nrf.mk deleted file mode 100644 index f0d1f172..00000000 --- a/nrf/nrf.mk +++ /dev/null @@ -1,6 +0,0 @@ -NRFSRC = nrf/spi_sw.c \ - nrf/rf.c \ - nrf/rfhelp.c \ - nrf/nrf_driver.c - -NRFINC = nrf diff --git a/tests/float_serialization/Makefile b/tests/float_serialization/Makefile index 1bc7bac9..0447a684 100644 --- a/tests/float_serialization/Makefile +++ b/tests/float_serialization/Makefile @@ -1,9 +1,9 @@ TARGET = test LIBS = -lm CC = gcc -CFLAGS = -O2 -g -Wall -Wextra -Wundef -std=gnu99 -I../../ -DNO_STM32 -SOURCES = main.c ../../buffer.c -HEADERS = ../../buffer.h +CFLAGS = -O2 -g -Wall -Wextra -Wundef -std=gnu99 -I../../util -DNO_STM32 +SOURCES = main.c ../../util/buffer.c +HEADERS = ../../util/buffer.h OBJECTS = $(notdir $(SOURCES:.c=.o)) .PHONY: default all clean @@ -17,6 +17,9 @@ all: default %.o: ../../%.c $(HEADERS) $(CC) $(CFLAGS) -c $< -o $@ +%.o: ../../util/%.c $(HEADERS) + $(CC) $(CFLAGS) -c $< -o $@ + .PRECIOUS: $(TARGET) $(OBJECTS) $(TARGET): $(OBJECTS) diff --git a/tests/packet_recovery/Makefile b/tests/packet_recovery/Makefile index 053eead7..2b5ee8ef 100644 --- a/tests/packet_recovery/Makefile +++ b/tests/packet_recovery/Makefile @@ -1,9 +1,9 @@ TARGET = test LIBS = -lm CC = gcc -CFLAGS = -O2 -g -Wall -Wextra -Wundef -std=gnu99 -I../../ -DNO_STM32 -SOURCES = main.c ../../packet.c ../../crc.c -HEADERS = ../../packet.h ../../crc.h +CFLAGS = -O2 -g -Wall -Wextra -Wundef -std=gnu99 -I../../util -I../../comm -DNO_STM32 +SOURCES = main.c ../../comm/packet.c ../../util/crc.c +HEADERS = ../../comm/packet.h ../../util/crc.h OBJECTS = $(notdir $(SOURCES:.c=.o)) .PHONY: default all clean @@ -16,6 +16,12 @@ all: default %.o: ../../%.c $(HEADERS) $(CC) $(CFLAGS) -c $< -o $@ + +%.o: ../../comm/%.c $(HEADERS) + $(CC) $(CFLAGS) -c $< -o $@ + +%.o: ../../util/%.c $(HEADERS) + $(CC) $(CFLAGS) -c $< -o $@ .PRECIOUS: $(TARGET) $(OBJECTS) diff --git a/buffer.c b/util/buffer.c similarity index 100% rename from buffer.c rename to util/buffer.c diff --git a/buffer.h b/util/buffer.h similarity index 100% rename from buffer.h rename to util/buffer.h diff --git a/crc.c b/util/crc.c similarity index 100% rename from crc.c rename to util/crc.c diff --git a/crc.h b/util/crc.h similarity index 100% rename from crc.h rename to util/crc.h diff --git a/digital_filter.c b/util/digital_filter.c similarity index 100% rename from digital_filter.c rename to util/digital_filter.c diff --git a/digital_filter.h b/util/digital_filter.h similarity index 100% rename from digital_filter.h rename to util/digital_filter.h diff --git a/lzo/README.LZO b/util/lzo/README.LZO similarity index 100% rename from lzo/README.LZO rename to util/lzo/README.LZO diff --git a/lzo/lzoconf.h b/util/lzo/lzoconf.h similarity index 100% rename from lzo/lzoconf.h rename to util/lzo/lzoconf.h diff --git a/lzo/lzodefs.h b/util/lzo/lzodefs.h similarity index 100% rename from lzo/lzodefs.h rename to util/lzo/lzodefs.h diff --git a/lzo/minilzo.c b/util/lzo/minilzo.c similarity index 100% rename from lzo/minilzo.c rename to util/lzo/minilzo.c diff --git a/lzo/minilzo.h b/util/lzo/minilzo.h similarity index 100% rename from lzo/minilzo.h rename to util/lzo/minilzo.h diff --git a/mempools.c b/util/mempools.c similarity index 100% rename from mempools.c rename to util/mempools.c diff --git a/mempools.h b/util/mempools.h similarity index 100% rename from mempools.h rename to util/mempools.h diff --git a/util/util.mk b/util/util.mk new file mode 100644 index 00000000..9caaa98e --- /dev/null +++ b/util/util.mk @@ -0,0 +1,14 @@ +CSRC += \ + util/buffer.c \ + util/crc.c \ + util/digital_filter.c \ + util/mempools.c \ + util/utils_math.c \ + util/utils_sys.c \ + util/worker.c \ + util/lzo/minilzo.c + +INCDIR += \ + util \ + util/lzo + diff --git a/utils.h b/util/utils.h similarity index 100% rename from utils.h rename to util/utils.h diff --git a/utils_math.c b/util/utils_math.c similarity index 100% rename from utils_math.c rename to util/utils_math.c diff --git a/utils_math.h b/util/utils_math.h similarity index 100% rename from utils_math.h rename to util/utils_math.h diff --git a/utils_sys.c b/util/utils_sys.c similarity index 100% rename from utils_sys.c rename to util/utils_sys.c diff --git a/utils_sys.h b/util/utils_sys.h similarity index 100% rename from utils_sys.h rename to util/utils_sys.h diff --git a/worker.c b/util/worker.c similarity index 100% rename from worker.c rename to util/worker.c diff --git a/worker.h b/util/worker.h similarity index 100% rename from worker.h rename to util/worker.h