diff --git a/conf/autopilot/booz2_test_progs.makefile b/conf/autopilot/booz2_test_progs.makefile index aab10a795c..1d35e9ce1b 100644 --- a/conf/autopilot/booz2_test_progs.makefile +++ b/conf/autopilot/booz2_test_progs.makefile @@ -195,7 +195,7 @@ test_usb.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DUSE_USB_SERIAL test_usb.CFLAGS += -DDOWNLINK_DEVICE=UsbS -DPPRZ_UART=UsbS -DDATALINK=PPRZ test_usb.srcs += downlink.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/usb_ser_hw.c pprz_transport.c -# datalink.c +# $(SRC_FIRMWARE)/datalink.c test_usb.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c test_usb.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c @@ -430,7 +430,7 @@ test_amc.srcs += $(SRC_ARCH)/uart_hw.c test_amc.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 test_amc.srcs += downlink.c pprz_transport.c test_amc.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart1 -test_amc.srcs += $(SRC_BOOZ)/booz2_datalink.c +test_amc.srcs += $(SRC_FIRMWARE)/datalink.c test_amc.CFLAGS += -DACTUATORS=\"actuators_asctec_twi_blmc_hw.h\" test_amc.srcs += $(SRC_BOOZ_ARCH)/actuators_asctec_twi_blmc_hw.c actuators.c diff --git a/conf/autopilot/lisa_l_test_progs.makefile b/conf/autopilot/lisa_l_test_progs.makefile index ab9527b999..1969bba036 100644 --- a/conf/autopilot/lisa_l_test_progs.makefile +++ b/conf/autopilot/lisa_l_test_progs.makefile @@ -53,6 +53,7 @@ SRC_BOARD=boards/$(BOARD) SRC_FIRMWARE=firmwares/rotorcraft SRC_SUBSYSTEMS=subsystems +SRC_AIRBORNE=. # # default configuration expected from the board files @@ -67,7 +68,9 @@ SRC_SUBSYSTEMS=subsystems test_led.ARCHDIR = $(ARCH) test_led.CFLAGS += -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT test_led.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_led.srcs += $(SRC_LISA)/test_led.c \ +test_led.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_LISA)/test_led.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c test_led.CFLAGS += -DUSE_LED @@ -79,10 +82,12 @@ test_led.srcs += $(SRC_ARCH)/led_hw.c test_uart.ARCHDIR = $(ARCH) test_uart.CFLAGS = -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT test_uart.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_uart.srcs = $(SRC_LISA)/test_uart.c \ +test_uart.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_LISA)/test_uart.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c -test_uart.CFLAGS += -DUSE_LED +test_uart.CFLAGS += -DUSE_LED -DUSE_UART test_uart.srcs += $(SRC_ARCH)/led_hw.c test_uart.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=$(SYS_TIME_LED) test_uart.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' @@ -90,7 +95,7 @@ test_uart.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_uart.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 test_uart.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600 test_uart.CFLAGS += -DUSE_UART3 -DUART3_BAUD=B57600 -test_uart.srcs += $(SRC_ARCH)/uart_hw.c +test_uart.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c @@ -104,7 +109,9 @@ test_servos.ARCHDIR = $(ARCH) test_servos.CFLAGS = -I$(SRC_FIRMWARE)/actuators/arch/$(ARCH) -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT test_servos.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) test_servos.LDFLAGS += -lm -test_servos.srcs += $(SRC_LISA)/test_servos.c \ +test_servos.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_LISA)/test_servos.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c test_servos.CFLAGS += -DUSE_LED @@ -126,9 +133,11 @@ test_servos.srcs += $(SRC_FIRMWARE)/actuators/actuators_pwm.c $(SRC_FIRMWARE)/ac test_telemetry.ARCHDIR = $(ARCH) test_telemetry.CFLAGS += -I$(SRC_LISA) -I$(SRC_ARCH) -DPERIPHERALS_AUTO_INIT test_telemetry.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_telemetry.srcs = test/test_telemetry.c \ - $(SRC_ARCH)/stm32_exceptions.c \ - $(SRC_ARCH)/stm32_vector_table.c +test_telemetry.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + test/test_telemetry.c \ + $(SRC_ARCH)/stm32_exceptions.c \ + $(SRC_ARCH)/stm32_vector_table.c test_telemetry.CFLAGS += -DUSE_LED test_telemetry.srcs += $(SRC_ARCH)/led_hw.c test_telemetry.CFLAGS += -DUSE_SYS_TIME @@ -139,7 +148,7 @@ test_telemetry.CFLAGS += -DUSE_$(MODEM_PORT) test_telemetry.CFLAGS += -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) test_telemetry.srcs += downlink.c pprz_transport.c test_telemetry.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) -test_telemetry.srcs += $(SRC_ARCH)/uart_hw.c +test_telemetry.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c # @@ -153,7 +162,9 @@ test_telemetry.srcs += $(SRC_ARCH)/uart_hw.c test_baro.ARCHDIR = $(ARCH) test_baro.CFLAGS = -I$(SRC_LISA) -I$(SRC_ARCH) -I$(SRC_BOARD) -DPERIPHERALS_AUTO_INIT test_baro.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_baro.srcs = $(SRC_BOARD)/test_baro.c \ +test_baro.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_BOARD)/test_baro.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c test_baro.CFLAGS += -DUSE_LED @@ -165,10 +176,10 @@ test_baro.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_baro.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) test_baro.srcs += downlink.c pprz_transport.c test_baro.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_baro.srcs += $(SRC_ARCH)/uart_hw.c +test_baro.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_baro.srcs += $(SRC_BOARD)/baro_board.c test_baro.CFLAGS += -DUSE_I2C2 -test_baro.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_baro.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c # @@ -185,7 +196,9 @@ test_rc_spektrum.ARCHDIR = $(ARCH) test_rc_spektrum.CFLAGS += -I$(SRC_ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT test_rc_spektrum.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_rc_spektrum.srcs += $(SRC_BOOZ_TEST)/booz2_test_radio_control.c \ +test_rc_spektrum.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_BOOZ_TEST)/booz2_test_radio_control.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -196,7 +209,7 @@ test_rc_spektrum.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' test_rc_spektrum.CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED) test_rc_spektrum.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_rc_spektrum.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_rc_spektrum.srcs += $(SRC_ARCH)/uart_hw.c +test_rc_spektrum.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_rc_spektrum.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) test_rc_spektrum.srcs += downlink.c pprz_transport.c test_rc_spektrum.CFLAGS += -DRADIO_CONTROL @@ -226,7 +239,9 @@ test_rc_ppm.ARCHDIR = $(ARCH) test_rc_ppm.CFLAGS += -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -I$(SRC_BOARD) test_rc_ppm.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) test_rc_ppm.CFLAGS += -DPERIPHERALS_AUTO_INIT -test_rc_ppm.srcs += $(SRC_BOOZ)/test/booz2_test_radio_control.c \ +test_rc_ppm.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_BOOZ)/test/booz2_test_radio_control.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -237,7 +252,7 @@ test_rc_ppm.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' test_rc_ppm.CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED) test_rc_ppm.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_rc_ppm.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_rc_ppm.srcs += $(SRC_ARCH)/uart_hw.c +test_rc_ppm.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_rc_ppm.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) test_rc_ppm.srcs += downlink.c pprz_transport.c test_rc_ppm.CFLAGS += -DRADIO_CONTROL @@ -261,7 +276,9 @@ test_adc.ARCHDIR = $(ARCH) test_adc.CFLAGS = -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT test_adc.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_adc.srcs = $(SRC_LISA)/test_adc.c \ +test_adc.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_LISA)/test_adc.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -274,7 +291,7 @@ test_adc.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' test_adc.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_adc.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_adc.srcs += $(SRC_ARCH)/uart_hw.c +test_adc.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_adc.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=$(MODEM_PORT) test_adc.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) @@ -296,7 +313,9 @@ test_adc.CFLAGS += -DUSE_ADC1_2_IRQ_HANDLER test_imu_b2.ARCHDIR = $(ARCH) test_imu_b2.CFLAGS = -I$(SRC_LISA) -I$(ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT test_imu_b2.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_imu_b2.srcs += $(SRC_BOOZ_TEST)/booz_test_imu.c \ +test_imu_b2.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_BOOZ_TEST)/booz_test_imu.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -309,7 +328,7 @@ test_imu_b2.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' test_imu_b2.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_imu_b2.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_imu_b2.srcs += $(SRC_ARCH)/uart_hw.c +test_imu_b2.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_imu_b2.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 test_imu_b2.srcs += downlink.c pprz_transport.c @@ -337,7 +356,9 @@ test_imu_b2.srcs += peripherals/ms2001.c $(SRC_ARCH)/peripherals/ms2001_arch.c test_imu_b2_2.ARCHDIR = $(ARCH) test_imu_b2_2.CFLAGS = -I$(SRC_LISA) -I$(ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT test_imu_b2_2.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_imu_b2_2.srcs += $(SRC_BOOZ_TEST)/booz_test_imu.c \ +test_imu_b2_2.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_BOOZ_TEST)/booz_test_imu.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -350,7 +371,7 @@ test_imu_b2_2.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' test_imu_b2_2.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_imu_b2_2.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_imu_b2_2.srcs += $(SRC_ARCH)/uart_hw.c +test_imu_b2_2.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_imu_b2_2.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 test_imu_b2_2.srcs += downlink.c pprz_transport.c @@ -366,7 +387,7 @@ test_imu_b2_2.CFLAGS += -DUSE_SPI2 -DUSE_DMA1_C4_IRQ -DUSE_EXTI2_IRQ -DUSE_SPI2_ test_imu_b2_2.srcs += $(SRC_SUBSYSTEMS)/imu/imu_b2.c $(SRC_ARCH)/subsystems/imu/imu_b2_arch.c test_imu_b2_2.srcs += peripherals/max1168.c $(SRC_ARCH)/peripherals/max1168_arch.c test_imu_b2_2.CFLAGS += -DUSE_I2C2 -test_imu_b2_2.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_imu_b2_2.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c test_imu_b2_2.srcs += peripherals/hmc5843.c $(SRC_BOOZ_ARCH)/peripherals/hmc5843_arch.c test_imu_b2_2.CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5 @@ -377,7 +398,9 @@ test_imu_b2_2.CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5 test_imu_aspirin.ARCHDIR = $(ARCH) test_imu_aspirin.CFLAGS = -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT test_imu_aspirin.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_imu_aspirin.srcs += $(SRC_BOOZ_TEST)/booz_test_imu.c \ +test_imu_aspirin.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_BOOZ_TEST)/booz_test_imu.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -389,7 +412,7 @@ test_imu_aspirin.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' test_imu_aspirin.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_imu_aspirin.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600 -test_imu_aspirin.srcs += $(SRC_ARCH)/uart_hw.c +test_imu_aspirin.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_imu_aspirin.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 test_imu_aspirin.srcs += downlink.c pprz_transport.c @@ -402,7 +425,7 @@ test_imu_aspirin.srcs += $(SRC_SUBSYSTEMS)/imu.c \ $(SRC_ARCH)/subsystems/imu/imu_aspirin_arch.c test_imu_aspirin.CFLAGS += -DUSE_I2C2 -test_imu_aspirin.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_imu_aspirin.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c test_imu_aspirin.CFLAGS += -DUSE_EXTI15_10_IRQ # Gyro Int on PC14 test_imu_aspirin.CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5 test_imu_aspirin.CFLAGS += -DUSE_EXTI2_IRQ # Accel Int on PD2 @@ -422,7 +445,9 @@ test_imu_aspirin.CFLAGS += -DUSE_DMA1_C4_IRQ # SPI2 Rx DMA test_hmc5843.ARCHDIR = $(ARCH) test_hmc5843.CFLAGS = -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(ARCH) -Ibooz -DPERIPHERALS_AUTO_INIT test_hmc5843.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_hmc5843.srcs = lisa/test/lisa_test_hmc5843.c \ +test_hmc5843.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + lisa/test/lisa_test_hmc5843.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c test_hmc5843.CFLAGS += -DUSE_LED @@ -432,13 +457,13 @@ test_hmc5843.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' test_hmc5843.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_hmc5843.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_hmc5843.srcs += $(SRC_ARCH)/uart_hw.c +test_hmc5843.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_hmc5843.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) test_hmc5843.srcs += downlink.c pprz_transport.c test_hmc5843.CFLAGS += -DUSE_I2C2 -test_hmc5843.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_hmc5843.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c test_hmc5843.CFLAGS += -DIMU_OVERRIDE_CHANNELS test_hmc5843.CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5 @@ -449,7 +474,9 @@ test_hmc5843.CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5 test_itg3200.ARCHDIR = $(ARCH) test_itg3200.CFLAGS = -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT test_itg3200.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_itg3200.srcs += lisa/test/lisa_test_itg3200.c \ +test_itg3200.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + lisa/test/lisa_test_itg3200.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -461,13 +488,13 @@ test_itg3200.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' test_itg3200.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_itg3200.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_itg3200.srcs += $(SRC_ARCH)/uart_hw.c +test_itg3200.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_itg3200.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) test_itg3200.srcs += downlink.c pprz_transport.c test_itg3200.CFLAGS += -DUSE_I2C2 -test_itg3200.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_itg3200.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c test_itg3200.CFLAGS += -DUSE_EXTI15_10_IRQ # Gyro Int on PC14 @@ -477,7 +504,9 @@ test_itg3200.CFLAGS += -DUSE_EXTI15_10_IRQ # Gyro Int on PC14 test_adxl345.ARCHDIR = $(ARCH) test_adxl345.CFLAGS = -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT test_adxl345.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_adxl345.srcs += lisa/test/lisa_test_adxl345_dma.c \ +test_adxl345.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + lisa/test/lisa_test_adxl345_dma.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -489,7 +518,7 @@ test_adxl345.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' test_adxl345.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_adxl345.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600 -test_adxl345.srcs += $(SRC_ARCH)/uart_hw.c +test_adxl345.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_adxl345.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 test_adxl345.srcs += downlink.c pprz_transport.c @@ -505,7 +534,9 @@ test_adxl345.CFLAGS += -DUSE_DMA1_C4_IRQ # SPI2 Rx DMA test_esc_mkk_simple.ARCHDIR = $(ARCH) test_esc_mkk_simple.CFLAGS = -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT test_esc_mkk_simple.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_esc_mkk_simple.srcs = test/test_esc_mkk_simple.c \ +test_esc_mkk_simple.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + test/test_esc_mkk_simple.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c test_esc_mkk_simple.CFLAGS += -DUSE_LED @@ -514,7 +545,7 @@ test_esc_mkk_simple.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=$(SYS_TIME_LED) test_esc_mkk_simple.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' test_esc_mkk_simple.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_esc_mkk_simple.CFLAGS += -DUSE_I2C2 -test_esc_mkk_simple.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_esc_mkk_simple.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c test_esc_mkk_simple.CFLAGS += -DACTUATORS_MKK_DEV=i2c2 @@ -524,7 +555,9 @@ test_esc_mkk_simple.CFLAGS += -DACTUATORS_MKK_DEV=i2c2 test_esc_asctecv1_simple.ARCHDIR = $(ARCH) test_esc_asctecv1_simple.CFLAGS = -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT test_esc_asctecv1_simple.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_esc_asctecv1_simple.srcs = test/test_esc_asctecv1_simple.c \ +test_esc_asctecv1_simple.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + test/test_esc_asctecv1_simple.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c test_esc_asctecv1_simple.CFLAGS += -DUSE_LED @@ -533,7 +566,7 @@ test_esc_asctecv1_simple.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=1 test_esc_asctecv1_simple.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' test_esc_asctecv1_simple.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_esc_asctecv1_simple.CFLAGS += -DUSE_I2C1 -test_esc_asctecv1_simple.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_esc_asctecv1_simple.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c # @@ -542,7 +575,9 @@ test_esc_asctecv1_simple.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c test_actuators_mkk.ARCHDIR = $(ARCH) test_actuators_mkk.CFLAGS = -I$(SRC_LISA) -I$(ARCH) -I$(SRC_BOOZ) -DPERIPHERALS_AUTO_INIT test_actuators_mkk.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_actuators_mkk.srcs = test/test_actuators.c \ +test_actuators_mkk.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + test/test_actuators.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -554,7 +589,7 @@ test_actuators_mkk.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' test_actuators_mkk.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_actuators_mkk.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600 -test_actuators_mkk.srcs += $(SRC_ARCH)/uart_hw.c +test_actuators_mkk.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_actuators_mkk.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 test_actuators_mkk.srcs += downlink.c pprz_transport.c @@ -564,7 +599,7 @@ test_actuators_mkk.srcs += $(SRC_FIRMWARE)/actuators/actuators_mkk.c test_actuators_mkk.CFLAGS += -DACTUATORS_MKK_DEVICE=i2c1 test_actuators_mkk.srcs += $(SRC_FIRMWARE)/actuators/supervision.c test_actuators_mkk.CFLAGS += -DUSE_I2C1 -test_actuators_mkk.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_actuators_mkk.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c # # test actuators asctecv1 @@ -572,7 +607,9 @@ test_actuators_mkk.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c test_actuators_asctecv1.ARCHDIR = $(ARCH) test_actuators_asctecv1.CFLAGS = -I$(SRC_LISA) -I$(ARCH) -I$(SRC_BOOZ) -DPERIPHERALS_AUTO_INIT test_actuators_asctecv1.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_actuators_asctecv1.srcs = test/test_actuators.c \ +test_actuators_asctecv1.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + test/test_actuators.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c @@ -584,7 +621,7 @@ test_actuators_asctecv1.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512 test_actuators_asctecv1.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_actuators_asctecv1.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600 -test_actuators_asctecv1.srcs += $(SRC_ARCH)/uart_hw.c +test_actuators_asctecv1.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_actuators_asctecv1.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 test_actuators_asctecv1.srcs += downlink.c pprz_transport.c @@ -593,7 +630,7 @@ test_actuators_asctecv1.srcs += $(SRC_BOOZ)/booz2_commands.c test_actuators_asctecv1.CFLAGS += -DACTUATORS_ASCTEC_DEVICE=i2c1 test_actuators_asctecv1.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c test_actuators_asctecv1.CFLAGS += -DUSE_I2C1 -test_actuators_asctecv1.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_actuators_asctecv1.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c # @@ -602,7 +639,9 @@ test_actuators_asctecv1.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c test_bmp085.ARCHDIR = $(ARCH) test_bmp085.CFLAGS = -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT test_bmp085.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_bmp085.srcs = lisa/test/lisa_test_bmp085.c \ +test_bmp085.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + lisa/test/lisa_test_bmp085.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c test_bmp085.CFLAGS += -DUSE_LED @@ -612,13 +651,13 @@ test_bmp085.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' test_bmp085.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_bmp085.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_bmp085.srcs += $(SRC_ARCH)/uart_hw.c +test_bmp085.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_bmp085.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) test_bmp085.srcs += downlink.c pprz_transport.c test_bmp085.CFLAGS += -DUSE_I2C2 -test_bmp085.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +test_bmp085.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c #test_bmp085.CFLAGS += -DIMU_OVERRIDE_CHANNELS #test_bmp085.CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5 @@ -630,7 +669,9 @@ test_bmp085.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c test_manual.ARCHDIR = $(ARCH) test_manual.CFLAGS = -I$(SRC_FIRMWARE) -I$(ARCH) -DPERIPHERALS_AUTO_INIT test_manual.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_manual.srcs = test/test_manual.c \ +test_manual.srcs = $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + test/test_manual.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c test_manual.CFLAGS += -DUSE_LED @@ -640,7 +681,7 @@ test_manual.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' test_manual.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c test_manual.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -test_manual.srcs += $(SRC_ARCH)/uart_hw.c +test_manual.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c test_manual.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) test_manual.srcs += downlink.c pprz_transport.c @@ -674,7 +715,9 @@ test_manual.srcs += $(SRC_SUBSYSTEMS)/radio_control.c tunnel.ARCHDIR = $(ARCH) tunnel.CFLAGS += -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT tunnel.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -tunnel.srcs += $(SRC_LISA)/tunnel_hw.c \ +tunnel.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_LISA)/tunnel_hw.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c tunnel.CFLAGS += -DUSE_LED diff --git a/conf/autopilot/lisa_passthrough.makefile b/conf/autopilot/lisa_passthrough.makefile index 2241a70455..a61cf4bfe1 100644 --- a/conf/autopilot/lisa_passthrough.makefile +++ b/conf/autopilot/lisa_passthrough.makefile @@ -42,7 +42,7 @@ stm_passthrough.CFLAGS += -DDOWNLINK stm_passthrough.CFLAGS += -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 stm_passthrough.srcs += downlink.c pprz_transport.c stm_passthrough.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600 -stm_passthrough.srcs += $(SRC_ARCH)/uart_hw.c +stm_passthrough.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c # Link Overo stm_passthrough.CFLAGS += -DUSE_OVERO_LINK @@ -75,7 +75,7 @@ stm_passthrough.srcs += $(SRC_BOOZ)/booz2_commands.c #stm_passthrough.srcs += $(SRC_FIRMWARE)/actuators/supervision.c #stm_passthrough.CFLAGS += -DACTUATORS_ASCTEC_V2_PROTOCOL #stm_passthrough.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c -#stm_passthrough.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +#stm_passthrough.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c # #stm_passthrough.CFLAGS += -DACTUATORS_ASCTEC_DEVICE=i2c1 #stm_passthrough.CFLAGS += -DUSE_I2C1 @@ -91,7 +91,7 @@ stm_passthrough.srcs += $(SRC_FIRMWARE)/actuators/arch/$(ARCH)/actuators_pwm_arc # Baro stm_passthrough.srcs += $(SRC_BOARD)/baro_board.c stm_passthrough.CFLAGS += -DUSE_I2C2 -stm_passthrough.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c +stm_passthrough.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c # Vanes stm_passthrough.CFLAGS += -I $(SRC_CSC) diff --git a/conf/autopilot/obsolete/lisa_test_progs.makefile b/conf/autopilot/obsolete/lisa_test_progs.makefile index 24bf199dbf..820d88da9d 100644 --- a/conf/autopilot/obsolete/lisa_test_progs.makefile +++ b/conf/autopilot/obsolete/lisa_test_progs.makefile @@ -268,7 +268,7 @@ test_datalink.srcs += $(SRC_ARCH)/uart_hw.c test_datalink.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 test_datalink.srcs += downlink.c pprz_transport.c test_datalink.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart2 -#test_datalink.srcs += $(SRC_BOOZ)/booz2_datalink.c +#test_datalink.srcs += $(SRC_FIRMWARE)/datalink.c # # tunnel diff --git a/conf/autopilot/rotorcraft.makefile b/conf/autopilot/rotorcraft.makefile index 07274c0b94..e42d413483 100644 --- a/conf/autopilot/rotorcraft.makefile +++ b/conf/autopilot/rotorcraft.makefile @@ -95,12 +95,12 @@ endif ap.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c ap.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport ap.CFLAGS += -DDOWNLINK_DEVICE=$(MODEM_PORT) -ap.srcs += $(SRC_FIRMWARE)/telemetry.c \ - downlink.c \ - pprz_transport.c +ap.srcs += $(SRC_FIRMWARE)/telemetry.c +ap.srcs += downlink.c +ap.srcs += pprz_transport.c ap.CFLAGS += -DDATALINK=PPRZ ap.CFLAGS += -DPPRZ_UART=$(MODEM_PORT) -ap.srcs += $(SRC_BOOZ)/booz2_datalink.c +ap.srcs += $(SRC_FIRMWARE)/datalink.c ap.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) ifeq ($(ARCH), lpc21) diff --git a/conf/autopilot/sitl.makefile b/conf/autopilot/sitl.makefile index f3971eb938..22b74c9876 100644 --- a/conf/autopilot/sitl.makefile +++ b/conf/autopilot/sitl.makefile @@ -14,7 +14,7 @@ sim.srcs += latlong.c\ sys_time.c\ $(SRC_FIRMWARE)/main_fbw.c \ $(SRC_FIRMWARE)/main_ap.c \ - datalink.c \ + $(SRC_FIRMWARE)/datalink.c \ $(SRC_ARCH)/ppm_hw.c \ $(SRC_ARCH)/sim_gps.c\ $(SRC_ARCH)/sim_ir.c \ diff --git a/conf/autopilot/sitl_jsbsim.makefile b/conf/autopilot/sitl_jsbsim.makefile index 06f62f724e..7259edccef 100644 --- a/conf/autopilot/sitl_jsbsim.makefile +++ b/conf/autopilot/sitl_jsbsim.makefile @@ -29,7 +29,7 @@ jsbsim.srcs = $(SRC_ARCH)/jsbsim_hw.c $(SRC_ARCH)/jsbsim_gps.c $(SRC_ARCH)/jsbsi jsbsim.srcs += latlong.c downlink.c commands.c gps.c inter_mcu.c subsystems/sensors/infrared.c \ $(SRC_FIXEDWING)/stabilization/stabilization_attitude.c \ $(SRC_FIXEDWING)/guidance/guidance_v.c\ - subsystems/nav.c estimator.c sys_time.c $(SRC_FIRMWARE)/main_fbw.c $(SRC_FIRMWARE)/main_ap.c datalink.c + subsystems/nav.c estimator.c sys_time.c $(SRC_FIRMWARE)/main_fbw.c $(SRC_FIRMWARE)/main_ap.c $(SRC_FIRMWARE)/datalink.c jsbsim.srcs += $(SIMDIR)/sim_ac_jsbsim.c # Choose in your airframe file type of airframe # jsbsim.srcs += $(SIMDIR)/sim_ac_fw.c diff --git a/conf/autopilot/sitl_link_pprz.makefile b/conf/autopilot/sitl_link_pprz.makefile index 2fcd2b8d91..313d5ee07f 100644 --- a/conf/autopilot/sitl_link_pprz.makefile +++ b/conf/autopilot/sitl_link_pprz.makefile @@ -1,3 +1,3 @@ sim.ARCHDIR = $(ARCH) sim.CFLAGS += -DSITL -DAP -DFBW -DRADIO_CONTROL -DINTER_MCU -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DUSE_INFRARED -DRADIO_CONTROL_SETTINGS -DSIM_UART -DDOWNLINK_AP_DEVICE=SimUart -DDOWNLINK_FBW_DEVICE=SimUart -DDATALINK=PPRZ -sim.srcs = radio_control.c downlink.c pprz_transport.c commands.c gps.c inter_mcu.c subsystems/sensors/infrared.c $(SRC_FIRMWARE)/stabilization/stabilization_attitude.c $(SRC_FIRMWARE)/guidance/guidance_v.c nav.c estimator.c cam.c sys_time.c $(SRC_FIRMWARE)/main_fbw.c $(SRC_FIRMWARE)/main_ap.c rc_settings.c $(SRC_ARCH)/ppm_hw.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/sim_ir.c $(SRC_ARCH)/sim_ap.c $(SRC_ARCH)/sim_uart.c datalink.c +sim.srcs = radio_control.c downlink.c pprz_transport.c commands.c gps.c inter_mcu.c subsystems/sensors/infrared.c $(SRC_FIRMWARE)/stabilization/stabilization_attitude.c $(SRC_FIRMWARE)/guidance/guidance_v.c nav.c estimator.c cam.c sys_time.c $(SRC_FIRMWARE)/main_fbw.c $(SRC_FIRMWARE)/main_ap.c rc_settings.c $(SRC_ARCH)/ppm_hw.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/sim_ir.c $(SRC_ARCH)/sim_ap.c $(SRC_ARCH)/sim_uart.c $(SRC_FIRMWARE)/datalink.c diff --git a/conf/autopilot/subsystems/fixedwing/autopilot.makefile b/conf/autopilot/subsystems/fixedwing/autopilot.makefile index 69986b4a7c..3a7b993420 100644 --- a/conf/autopilot/subsystems/fixedwing/autopilot.makefile +++ b/conf/autopilot/subsystems/fixedwing/autopilot.makefile @@ -179,7 +179,7 @@ sim.CFLAGS += -DSITL sim.srcs += $(SRC_ARCH)/sim_ap.c sim.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -sim.srcs += downlink.c datalink.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/sim_adc_generic.c +sim.srcs += downlink.c $(SRC_FIRMWARE)/datalink.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/sim_adc_generic.c ###################################################################### ## @@ -200,7 +200,7 @@ jsbsim.CFLAGS += -I$(SIMDIR) -I/usr/include -I$(JSBSIM_INC) `pkg-config glib-2 jsbsim.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lpcre -lglibivy -L/usr/lib -lJSBSim jsbsim.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -jsbsim.srcs += downlink.c datalink.c $(SRC_ARCH)/jsbsim_hw.c $(SRC_ARCH)/jsbsim_gps.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/jsbsim_transport.c +jsbsim.srcs += downlink.c $(SRC_FIRMWARE)/datalink.c $(SRC_ARCH)/jsbsim_hw.c $(SRC_ARCH)/jsbsim_gps.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/jsbsim_transport.c ###################################################################### ## diff --git a/conf/autopilot/subsystems/fixedwing/telemetry_transparent.makefile b/conf/autopilot/subsystems/fixedwing/telemetry_transparent.makefile index 6ad33ef3c8..8cbcfa9189 100644 --- a/conf/autopilot/subsystems/fixedwing/telemetry_transparent.makefile +++ b/conf/autopilot/subsystems/fixedwing/telemetry_transparent.makefile @@ -7,6 +7,6 @@ MODEM_UART = Uart$(MODEM_UART_NR) ap.CFLAGS += -DDOWNLINK -DDOWNLINK_FBW_DEVICE=$(MODEM_UART) -DDOWNLINK_AP_DEVICE=$(MODEM_UART) -DPPRZ_UART=$(MODEM_UART) ap.CFLAGS += -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ -ap.srcs += $(SRC_FIXEDWING)/downlink.c $(SRC_FIXEDWING)/datalink.c $(SRC_FIXEDWING)/pprz_transport.c +ap.srcs += $(SRC_FIXEDWING)/downlink.c $(SRC_FIRMWARE)/datalink.c $(SRC_FIXEDWING)/pprz_transport.c diff --git a/conf/autopilot/subsystems/fixedwing/telemetry_transparent_usb.makefile b/conf/autopilot/subsystems/fixedwing/telemetry_transparent_usb.makefile index eb77b500bd..fdc2d31baf 100644 --- a/conf/autopilot/subsystems/fixedwing/telemetry_transparent_usb.makefile +++ b/conf/autopilot/subsystems/fixedwing/telemetry_transparent_usb.makefile @@ -3,7 +3,7 @@ ap.CFLAGS += -DDOWNLINK -DDOWNLINK_FBW_DEVICE=UsbS -DDOWNLINK_AP_DEVICE=UsbS -DPPRZ_UART=UsbS ap.CFLAGS += -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ -DUSE_USB_SERIAL -DUSE_USB_HIGH_PCLK -ap.srcs += $(SRC_FIXEDWING)/downlink.c $(SRC_FIXEDWING)/datalink.c $(SRC_FIXEDWING)/pprz_transport.c +ap.srcs += $(SRC_FIXEDWING)/downlink.c $(SRC_FIRMWARE)/datalink.c $(SRC_FIXEDWING)/pprz_transport.c ap.srcs += $(SRC_ARCH)/usb_ser_hw.c $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c ap.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c diff --git a/conf/autopilot/subsystems/fixedwing/telemetry_xbee_api.makefile b/conf/autopilot/subsystems/fixedwing/telemetry_xbee_api.makefile index 1263c24044..3fdff1608d 100644 --- a/conf/autopilot/subsystems/fixedwing/telemetry_xbee_api.makefile +++ b/conf/autopilot/subsystems/fixedwing/telemetry_xbee_api.makefile @@ -7,4 +7,4 @@ MODEM_UART = Uart$(MODEM_UART_NR) ap.CFLAGS += -DDOWNLINK -DDOWNLINK_FBW_DEVICE=$(MODEM_UART) -DDOWNLINK_AP_DEVICE=$(MODEM_UART) -DXBEE_UART=$(MODEM_UART) ap.CFLAGS += -DDOWNLINK_TRANSPORT=XBeeTransport -DDATALINK=XBEE -ap.srcs += $(SRC_FIXEDWING)/downlink.c $(SRC_FIXEDWING)/datalink.c $(SRC_FIXEDWING)/xbee.c +ap.srcs += $(SRC_FIXEDWING)/downlink.c $(SRC_FIRMWARE)/datalink.c $(SRC_FIXEDWING)/xbee.c diff --git a/conf/autopilot/subsystems/rotorcraft/fdm_nps.makefile b/conf/autopilot/subsystems/rotorcraft/fdm_nps.makefile index 40f08f0fe6..8a0b64bafe 100644 --- a/conf/autopilot/subsystems/rotorcraft/fdm_nps.makefile +++ b/conf/autopilot/subsystems/rotorcraft/fdm_nps.makefile @@ -81,7 +81,7 @@ sim.srcs += $(SRC_FIRMWARE)/telemetry.c \ sim.srcs += $(SRC_BOOZ)/booz2_commands.c -sim.srcs += $(SRC_BOOZ)/booz2_datalink.c +sim.srcs += $(SRC_FIRMWARE)/datalink.c # # diff --git a/conf/boards/booz_1.0.makefile b/conf/boards/booz_1.0.makefile index 7e9184cf5c..1f56efef5b 100644 --- a/conf/boards/booz_1.0.makefile +++ b/conf/boards/booz_1.0.makefile @@ -25,11 +25,19 @@ RADIO_CONTROL_LINK = UART0 BARO_LED = 2 +ifndef MODEM_PORT MODEM_PORT = UART1 +endif +ifndef MODEM_BAUD MODEM_BAUD = B57600 +endif AHRS_ALIGNER_LED = 3 +ifndef GPS_PORT GPS_PORT=UART0 +endif +ifndef GPS_BAUD GPS_BAUD=B38400 +endif GPS_LED=4 diff --git a/conf/boards/hb_1.1.makefile b/conf/boards/hb_1.1.makefile index 16c134efc5..8cb1393b3a 100644 --- a/conf/boards/hb_1.1.makefile +++ b/conf/boards/hb_1.1.makefile @@ -22,8 +22,16 @@ SYS_TIME_LED = 1 # not used on rotorcraft, only for tests RADIO_CONTROL_LINK = UART0 +ifndef MODEM_PORT MODEM_PORT = UART0 +endif +ifndef MODEM_BAUD MODEM_BAUD = B57600 +endif +ifndef GPS_PORT GPS_PORT=UART1 +endif +ifndef GPS_BAUD GPS_BAUD=B38400 +endif diff --git a/conf/boards/lisa_l_1.0.makefile b/conf/boards/lisa_l_1.0.makefile index a821a51298..35717910a1 100644 --- a/conf/boards/lisa_l_1.0.makefile +++ b/conf/boards/lisa_l_1.0.makefile @@ -41,13 +41,21 @@ RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT = UART3 RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT = UART5 RADIO_CONTROL_LED = 5 +ifndef MODEM_PORT MODEM_PORT=UART2 +endif +ifndef MODEM_BAUD MODEM_BAUD=B57600 +endif AHRS_ALIGNER_LED = 7 +ifndef GPS_PORT GPS_PORT=UART1 +endif +ifndef GPS_BAUD GPS_BAUD=B38400 +endif GPS_LED = 3 # diff --git a/conf/radios/mc22.xml b/conf/radios/mc22.xml new file mode 100644 index 0000000000..43adfdd64a --- /dev/null +++ b/conf/radios/mc22.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sw/airborne/arch/lpc21/peripherals/max1168_arch.c b/sw/airborne/arch/lpc21/peripherals/max1168_arch.c index 14a45313da..060fafcde8 100644 --- a/sw/airborne/arch/lpc21/peripherals/max1168_arch.c +++ b/sw/airborne/arch/lpc21/peripherals/max1168_arch.c @@ -59,6 +59,7 @@ void max1168_read( void ) { SSP_DisableRti(); SSP_Enable(); /* write control byte - wait EOC on extint */ + /* use internal reference and clock, sequentially scan channels 0-7 */ SSPDR = (1 << 0 | 1 << 3 | 7 << 5) << 8; max1168_status = STA_MAX1168_SENDING_REQ; diff --git a/sw/airborne/arch/stm32/peripherals/hmc8543_arch.c b/sw/airborne/arch/stm32/peripherals/hmc5843_arch.c similarity index 100% rename from sw/airborne/arch/stm32/peripherals/hmc8543_arch.c rename to sw/airborne/arch/stm32/peripherals/hmc5843_arch.c diff --git a/sw/airborne/arch/stm32/peripherals/hmc8543_arch.h b/sw/airborne/arch/stm32/peripherals/hmc5843_arch.h similarity index 100% rename from sw/airborne/arch/stm32/peripherals/hmc8543_arch.h rename to sw/airborne/arch/stm32/peripherals/hmc5843_arch.h diff --git a/sw/airborne/arch/stm32/peripherals/max1168_arch.c b/sw/airborne/arch/stm32/peripherals/max1168_arch.c index f39881bc80..3239a3ad86 100644 --- a/sw/airborne/arch/stm32/peripherals/max1168_arch.c +++ b/sw/airborne/arch/stm32/peripherals/max1168_arch.c @@ -97,6 +97,7 @@ void max1168_read( void ) { Max1168Select(); /* write control byte - wait EOC on extint */ + /* use internal reference and clock, sequentially scan channels 0-7 */ const uint16_t ctl_byte = (1 << 0 | 1 << 3 | 7 << 5) << 8; SPI_I2S_SendData(SPI2, ctl_byte); max1168_status = STA_MAX1168_SENDING_REQ; diff --git a/sw/airborne/boards/lisa_l/test_baro.c b/sw/airborne/boards/lisa_l/test_baro.c index 20e9dbef66..8a24041f53 100644 --- a/sw/airborne/boards/lisa_l/test_baro.c +++ b/sw/airborne/boards/lisa_l/test_baro.c @@ -29,8 +29,9 @@ #include BOARD_CONFIG -#include "init_hw.h" +#include "mcu.h" #include "sys_time.h" +#include "mcu_periph/uart.h" #include "downlink.h" @@ -58,7 +59,7 @@ int main(void) { } static inline void main_init( void ) { - hw_init(); + mcu_init(); sys_time_init(); baro_init(); diff --git a/sw/airborne/booz/test/booz2_test_radio_control.c b/sw/airborne/booz/test/booz2_test_radio_control.c index f5b93da7a4..0c9e57e53a 100644 --- a/sw/airborne/booz/test/booz2_test_radio_control.c +++ b/sw/airborne/booz/test/booz2_test_radio_control.c @@ -23,9 +23,10 @@ #include -#include "init_hw.h" +#include "mcu.h" #include "sys_time.h" #include "interrupt_hw.h" +#include "mcu_periph/uart.h" #include "downlink.h" @@ -48,7 +49,7 @@ int main( void ) { } static inline void main_init( void ) { - hw_init(); + mcu_init(); sys_time_init(); radio_control_init(); int_enable(); diff --git a/sw/airborne/datalink.c b/sw/airborne/firmwares/fixedwing/datalink.c similarity index 100% rename from sw/airborne/datalink.c rename to sw/airborne/firmwares/fixedwing/datalink.c diff --git a/sw/airborne/booz/booz2_datalink.c b/sw/airborne/firmwares/rotorcraft/datalink.c similarity index 100% rename from sw/airborne/booz/booz2_datalink.c rename to sw/airborne/firmwares/rotorcraft/datalink.c diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index 4d72a022e3..9c5b87f70c 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -143,33 +143,32 @@ STATIC_INLINE void main_periodic( void ) { /* set actuators */ actuators_set(autopilot_motors_on); - PeriodicPrescaleBy10( \ - { \ - radio_control_periodic_task(); \ - if (radio_control.status != RC_OK && \ - autopilot_mode != AP_MODE_KILL && \ - autopilot_mode != AP_MODE_NAV) \ - autopilot_set_mode(AP_MODE_FAILSAFE); \ - }, \ - { \ - /* booz_fms_periodic(); FIXME */ \ - }, \ - { \ - /*BoozControlSurfacesSetFromCommands();*/ \ - }, \ - { \ - LED_PERIODIC(); \ - }, \ - { baro_periodic(); - }, \ - {}, \ - {}, \ - {}, \ - {}, \ - { \ - Booz2TelemetryPeriodic(); \ - } \ - ); \ + PeriodicPrescaleBy10( \ + { \ + radio_control_periodic_task(); \ + if (radio_control.status != RC_OK && \ + autopilot_mode != AP_MODE_KILL && \ + autopilot_mode != AP_MODE_NAV) \ + autopilot_set_mode(AP_MODE_FAILSAFE); \ + }, \ + { \ + /* booz_fms_periodic(); FIXME */ \ + }, \ + { \ + /*BoozControlSurfacesSetFromCommands();*/ \ + }, \ + { \ + LED_PERIODIC(); \ + }, \ + { baro_periodic(); \ + }, \ + {}, \ + {}, \ + {}, \ + {}, \ + { \ + Booz2TelemetryPeriodic(); \ + } ); #ifdef USE_GPS if (radio_control.status != RC_OK && \ diff --git a/sw/airborne/fms/overo_test_passthrough.c b/sw/airborne/fms/overo_test_passthrough.c index 826975fd6c..47002d5037 100644 --- a/sw/airborne/fms/overo_test_passthrough.c +++ b/sw/airborne/fms/overo_test_passthrough.c @@ -84,7 +84,7 @@ static void dialog_with_io_proc() { uint8_t crc_valid; for (uint8_t i=0; i<6; i++) msg_out.payload.msg_down.pwm_outputs_usecs[i] = otp.servos_outputs_usecs[i]; - for (uint8_t i=0; i<4; i++) msg_out.payload.msg_down.csc_servo_cmd[i] = otp.csc_servo_outputs[i]; +// for (uint8_t i=0; i<4; i++) msg_out.payload.msg_down.csc_servo_cmd[i] = otp.csc_servo_outputs[i]; spi_link_send(&msg_out, sizeof(struct AutopilotMessageCRCFrame), &msg_in, &crc_valid); diff --git a/sw/airborne/lisa/lisa_stm_passthrough_main.c b/sw/airborne/lisa/lisa_stm_passthrough_main.c index 60a3725cd6..c27e002e1d 100644 --- a/sw/airborne/lisa/lisa_stm_passthrough_main.c +++ b/sw/airborne/lisa/lisa_stm_passthrough_main.c @@ -23,20 +23,21 @@ */ #include "mcu.h" +#include "mcu_periph/uart.h" #include "sys_time.h" #include "downlink.h" #include "booz/booz2_commands.h" #include "actuators.h" #include "actuators/actuators_pwm.h" #include "subsystems/imu.h" -#include "booz/booz_radio_control.h" +#include "subsystems/radio_control.h" #include "autopilot.h" -#include "ins.h" +#include "subsystems/ins.h" #include "guidance.h" #include "navigation.h" #include "lisa/lisa_overo_link.h" #include "generated/airframe.h" -#include "ahrs.h" +#include "subsystems/ahrs.h" #ifdef PASSTHROUGH_CYGNUS #include "stabilization.h" #endif diff --git a/sw/airborne/lisa/test/lisa_test_hmc5843.c b/sw/airborne/lisa/test/lisa_test_hmc5843.c index 64b786a367..b21d0c84e9 100644 --- a/sw/airborne/lisa/test/lisa_test_hmc5843.c +++ b/sw/airborne/lisa/test/lisa_test_hmc5843.c @@ -34,11 +34,12 @@ */ #include BOARD_CONFIG -#include "init_hw.h" +#include "mcu.h" #include "sys_time.h" #include "downlink.h" #include "std.h" +#include "mcu_periph/uart.h" #include "peripherals/hmc5843.h" #include "my_debug_servo.h" #include "math/pprz_algebra_int.h" @@ -74,7 +75,7 @@ int main(void) { } static inline void main_init( void ) { - hw_init(); + mcu_init(); sys_time_init(); main_init_hw(); } diff --git a/sw/airborne/lisa/test/lisa_test_itg3200.c b/sw/airborne/lisa/test/lisa_test_itg3200.c index 9e425cdad2..66848cb408 100644 --- a/sw/airborne/lisa/test/lisa_test_itg3200.c +++ b/sw/airborne/lisa/test/lisa_test_itg3200.c @@ -35,7 +35,9 @@ #include #include BOARD_CONFIG -#include "init_hw.h" +#include "mcu.h" +#include "mcu_periph/uart.h" +#include "mcu_periph/i2c.h" #include "sys_time.h" #include "downlink.h" #include "std.h" @@ -71,7 +73,7 @@ int main(void) { } static inline void main_init( void ) { - hw_init(); + mcu_init(); sys_time_init(); main_init_hw(); } diff --git a/sw/airborne/lisa/test_adc.c b/sw/airborne/lisa/test_adc.c index 7132bc90e3..2666e8f0bb 100644 --- a/sw/airborne/lisa/test_adc.c +++ b/sw/airborne/lisa/test_adc.c @@ -30,6 +30,7 @@ #include "sys_time.h" #include "led.h" #include "mcu_periph/adc.h" +#include "mcu_periph/uart.h" #include "downlink.h" int main_periodic(void); diff --git a/sw/airborne/lisa/test_led.c b/sw/airborne/lisa/test_led.c index 887d62e540..0052006f56 100644 --- a/sw/airborne/lisa/test_led.c +++ b/sw/airborne/lisa/test_led.c @@ -25,7 +25,7 @@ #include #include BOARD_CONFIG -#include "init_hw.h" +#include "mcu.h" #include "led.h" void Delay(__IO uint32_t nCount); @@ -38,7 +38,7 @@ const int LED_PROG_OFF[LED_PROGRAM_SIZE] = {-1, -1, -1, -1, 3, 5, 7, 1, int main(void) { int i = 0; - hw_init(); + mcu_init(); while (1) { for (i=0; i< LED_PROGRAM_SIZE; i++) { diff --git a/sw/airborne/lisa/test_servos.c b/sw/airborne/lisa/test_servos.c index 4bf9235b67..533feedc1a 100644 --- a/sw/airborne/lisa/test_servos.c +++ b/sw/airborne/lisa/test_servos.c @@ -23,7 +23,7 @@ #include -#include "init_hw.h" +#include "mcu.h" #include "sys_time.h" #include "firmwares/rotorcraft/actuators/actuators_pwm.h" @@ -41,7 +41,7 @@ int main(void) { } static inline void main_init( void ) { - hw_init(); + mcu_init(); sys_time_init(); actuators_init(); } diff --git a/sw/airborne/lisa/test_uart.c b/sw/airborne/lisa/test_uart.c index cd0a3314f5..599c9581d2 100644 --- a/sw/airborne/lisa/test_uart.c +++ b/sw/airborne/lisa/test_uart.c @@ -28,7 +28,8 @@ #include #include BOARD_CONFIG -#include "init_hw.h" +#include "mcu.h" +#include "mcu_periph/uart.h" #include "sys_time.h" static inline void main_init( void ); @@ -46,7 +47,7 @@ int main(void) { } static inline void main_init( void ) { - hw_init(); + mcu_init(); sys_time_init(); } diff --git a/sw/airborne/subsystems/ins.c b/sw/airborne/subsystems/ins.c index df47371b6f..cd098c51b5 100644 --- a/sw/airborne/subsystems/ins.c +++ b/sw/airborne/subsystems/ins.c @@ -90,7 +90,7 @@ void ins_init() { #ifdef USE_INS_NAV_INIT ins_ltp_initialised = TRUE; - /** FIXME: should use the same code than MOVE_WP in booz2_datalink.c */ + /** FIXME: should use the same code than MOVE_WP in firmwares/rotorcraft/datalink.c */ struct LlaCoor_i llh; /* Height above the ellipsoid */ llh.lat = INT32_RAD_OF_DEG(NAV_LAT0); llh.lon = INT32_RAD_OF_DEG(NAV_LON0); diff --git a/sw/airborne/test/test_esc_mkk_simple.c b/sw/airborne/test/test_esc_mkk_simple.c index bc0f778bca..232890665a 100644 --- a/sw/airborne/test/test_esc_mkk_simple.c +++ b/sw/airborne/test/test_esc_mkk_simple.c @@ -22,7 +22,7 @@ */ -#include "mcuw.h" +#include "mcu.h" #include "sys_time.h" #include "led.h" diff --git a/sw/airborne/test/test_telemetry.c b/sw/airborne/test/test_telemetry.c index 81c1c64e29..d85739657b 100644 --- a/sw/airborne/test/test_telemetry.c +++ b/sw/airborne/test/test_telemetry.c @@ -22,7 +22,8 @@ */ #include BOARD_CONFIG -#include "init_hw.h" +#include "mcu.h" +#include "mcu_periph/uart.h" #include "interrupt_hw.h" #include "sys_time.h" #include "downlink.h" @@ -41,7 +42,7 @@ int main(void) { } static inline void main_init( void ) { - hw_init(); + mcu_init(); sys_time_init(); int_enable(); } diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index 6b357416d1..9c83aeea95 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -1039,7 +1039,8 @@ let listen_flight_params = fun geomap auto_center_new_ac alert alt_graph -> end else if agl > 25. then ac.ground_prox <- false; try - draw_altgraph alt_graph geomap aircrafts + if not (alt_graph#drawing_area#misc#parent = None) then + draw_altgraph alt_graph geomap aircrafts with _ -> () in diff --git a/sw/lib/ocaml/gtk_tools.ml b/sw/lib/ocaml/gtk_tools.ml index d44d88a0d9..f3a0fe0ddf 100644 --- a/sw/lib/ocaml/gtk_tools.ml +++ b/sw/lib/ocaml/gtk_tools.ml @@ -106,3 +106,47 @@ let combo_connect = fun ((combo: #GEdit.combo_box), (_,column)) cb -> let data = combo#model#get ~row ~column in cb data)) + +type tree = GTree.view * (GTree.list_store * string GTree.column) +let tree_widget = fst +let tree_model = snd + +let tree = fun (t:GTree.view) -> + let cols = new GTree.column_list in + let col_name = cols#add Gobject.Data.string in + let store = GTree.list_store cols in + t#set_model (Some store#coerce); + let col1 = GTree.view_column ~renderer:(GTree.cell_renderer_text [], ["text",col_name]) () in + ignore (t#append_column col1); + (t , (store, col_name)) + +let tree_of = fun (t:GTree.view) (m:(GTree.list_store * string GTree.column)) -> + (t, m) + +let tree_values = fun (tree : tree) -> + let (store, column) = tree_model tree in + let values = ref "" in + store#foreach (fun _ row -> + values := !values^" "^(store#get ~row ~column); + false); + !values + +let get_selected_in_tree = fun (tree : tree) -> + let (store, column) = tree_model tree in + let t = tree_widget tree in + let sel_paths = t#selection#get_selected_rows in + List.map (fun p -> store#get_row_reference p) sel_paths + +let add_to_tree = fun (tree : tree) string -> + let (store, column) = tree_model tree in + let row = store#append () in + store#set ~row ~column string + +let remove_selected_from_tree = fun (tree : tree) -> + let selected = get_selected_in_tree tree in + let (store, _) = tree_model tree in + List.iter (fun r -> ignore (store#remove r#iter)) selected + +let clear_tree = fun (tree : tree) -> + let (store, _) = tree_model tree in + store#clear () diff --git a/sw/lib/ocaml/gtk_tools.mli b/sw/lib/ocaml/gtk_tools.mli index c5489d68a6..678be6a30a 100644 --- a/sw/lib/ocaml/gtk_tools.mli +++ b/sw/lib/ocaml/gtk_tools.mli @@ -58,3 +58,17 @@ val combo_separator : string val combo_value : combo -> string val select_in_combo : combo -> string -> unit val combo_connect : combo -> (string -> unit) -> unit + +(*** Utilities for a tree view widget ***) +type tree +val tree_widget : tree -> GTree.view +val tree_model : tree -> (GTree.list_store * string GTree.column) + +val tree : GTree.view -> tree +val tree_of : GTree.view -> (GTree.list_store * string GTree.column) -> tree + +val tree_values : tree -> string +val get_selected_in_tree : tree -> GTree.row_reference list +val add_to_tree : tree -> string -> unit +val remove_selected_from_tree : tree -> unit +val clear_tree : tree -> unit diff --git a/sw/supervision/paparazzicenter.glade b/sw/supervision/paparazzicenter.glade index 95fbacff9d..cee69a6eb5 100644 --- a/sw/supervision/paparazzicenter.glade +++ b/sw/supervision/paparazzicenter.glade @@ -102,6 +102,7 @@ gtk-new True + True True @@ -111,6 +112,7 @@ gtk-delete True + True True @@ -154,6 +156,7 @@ gtk-new True + True True @@ -162,6 +165,7 @@ gtk-save True + True True @@ -542,38 +546,76 @@ True - + + 4 True - _________________ - True + True + False 0 - - ... + True - True - False - Browse (multiple selection allowed) - True False - False 1 - - gtk-edit + True - True - False - Launch an editor on the _first_ settings file - True + + + gtk-add + True + True + True + True + Add a settings file + True + True + + + False + False + 0 + + + + + gtk-edit + True + True + True + True + Launch an editor on all the settings file + True + + + False + False + 1 + + + + + gtk-remove + True + True + True + Remove the selected settings file + True + + + False + False + 2 + + False diff --git a/sw/supervision/pc_aircraft.ml b/sw/supervision/pc_aircraft.ml index 4c17ccb93d..05a5326e51 100644 --- a/sw/supervision/pc_aircraft.ml +++ b/sw/supervision/pc_aircraft.ml @@ -96,12 +96,21 @@ let gcs_or_edit = fun file -> | 2 -> ignore (Sys.command (sprintf "%s -edit '%s'&" gcs file)) | _ -> failwith "Internal error: gcs_or_edit" -let ac_files = fun gui -> - ["airframe", "airframes", gui#label_airframe, gui#button_browse_airframe, gui#button_edit_airframe, edit, false; - "flight_plan", "flight_plans", gui#label_flight_plan, gui#button_browse_flight_plan, gui#button_edit_flight_plan, gcs_or_edit, false; - "settings", "settings", gui#label_settings, gui#button_browse_settings, gui#button_edit_settings, edit, true; - "radio", "radios", gui#label_radio, gui#button_browse_radio, gui#button_edit_radio, edit, false; - "telemetry", "telemetry", gui#label_telemetry, gui#button_browse_telemetry, gui#button_edit_telemetry, edit, false] +type ac_data = + Label of GMisc.label + | Tree of Gtk_tools.tree + +let string_of_ac_data = fun d -> + match d with + Label l -> l#text + | Tree t -> Gtk_tools.tree_values t + +let ac_files = fun gui model -> + ["airframe", "airframes", Label gui#label_airframe, gui#button_browse_airframe, gui#button_edit_airframe, edit, None; + "flight_plan", "flight_plans", Label gui#label_flight_plan, gui#button_browse_flight_plan, gui#button_edit_flight_plan, gcs_or_edit, None; + "settings", "settings", Tree (Gtk_tools.tree_of gui#tree_settings model), gui#button_browse_settings, gui#button_edit_settings, edit, Some gui#button_remove_settings; + "radio", "radios", Label gui#label_radio, gui#button_browse_radio, gui#button_edit_radio, edit, None; + "telemetry", "telemetry", Label gui#label_telemetry, gui#button_browse_telemetry, gui#button_edit_telemetry, edit, None] (* Awful but easier *) @@ -124,7 +133,8 @@ let correct_ac_name = fun s -> with Exit -> false -let save_callback = fun ?user_save gui ac_combo () -> + (*TODO function text of date_type*) +let save_callback = fun ?user_save gui ac_combo model () -> let ac_name = Gtk_tools.combo_value ac_combo and ac_id = gui#entry_ac_id#text in @@ -133,6 +143,7 @@ let save_callback = fun ?user_save gui ac_combo () -> GToolbox.message_box ~title:"Error on A/C id" "A/C id must be a non null number less than 255" else let color = !current_color in + let tree = Gtk_tools.tree_of gui#tree_settings model in let aircraft = Xml.Element ("aircraft", ["name", ac_name; @@ -141,7 +152,7 @@ let save_callback = fun ?user_save gui ac_combo () -> "radio", gui#label_radio#text; "telemetry", gui#label_telemetry#text; "flight_plan", gui#label_flight_plan#text; - "settings", gui#label_settings#text; + "settings", Gtk_tools.tree_values tree; "gui_color", color], []) in begin try Hashtbl.remove Utils.aircrafts ac_name with _ -> () end; @@ -205,31 +216,43 @@ let parse_ac_targets = fun target_combo ac_file -> (* Link A/C to airframe & flight_plan labels *) let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo -> + (* build tree for settings *) + let tree_set = Gtk_tools.tree gui#tree_settings in + let model = Gtk_tools.tree_model tree_set in + (* attach vertical scrollbar *) + gui#tree_settings#set_vadjustment gui#tree_settings_scrollbar#adjustment; + + (* Update_params callback *) let update_params = fun ac_name -> try let aircraft = Hashtbl.find Utils.aircrafts ac_name in let sample = aircraft_sample ac_name "42" in let value = fun a -> - try (ExtXml.attrib aircraft a) with _ -> Xml.attrib sample a in - List.iter - (fun (a, _subdir, label, _, _, _, _) -> label#set_text (value a)) - (ac_files gui); - let ac_id = ExtXml.attrib aircraft "ac_id" - and gui_color = ExtXml.attrib_or_default aircraft "gui_color" "white" in - gui#button_clean#misc#set_sensitive true; - gui#button_build#misc#set_sensitive true; - gui#eventbox_gui_color#misc#modify_bg [`NORMAL, `NAME gui_color]; - current_color := gui_color; - gui#entry_ac_id#set_text ac_id; - (Gtk_tools.combo_widget target_combo)#misc#set_sensitive true; - parse_ac_targets target_combo (ExtXml.attrib aircraft "airframe"); + try (ExtXml.attrib aircraft a) with _ -> Xml.attrib sample a in + List.iter (fun (a, _subdir, label, _, _, _, _) -> + match label with + Label l -> l#set_text (value a) + | Tree t -> + ignore (Gtk_tools.clear_tree tree_set); + let names = Str.split regexp_space (value a) in + List.iter (fun n -> Gtk_tools.add_to_tree t n) names + ) (ac_files gui model); + let ac_id = ExtXml.attrib aircraft "ac_id" + and gui_color = ExtXml.attrib_or_default aircraft "gui_color" "white" in + gui#button_clean#misc#set_sensitive true; + gui#button_build#misc#set_sensitive true; + gui#eventbox_gui_color#misc#modify_bg [`NORMAL, `NAME gui_color]; + current_color := gui_color; + gui#entry_ac_id#set_text ac_id; + (Gtk_tools.combo_widget target_combo)#misc#set_sensitive true; + parse_ac_targets target_combo (ExtXml.attrib aircraft "airframe"); with Not_found -> - gui#label_airframe#set_text ""; - gui#label_flight_plan#set_text ""; - gui#button_clean#misc#set_sensitive false; - gui#button_build#misc#set_sensitive false; - (Gtk_tools.combo_widget target_combo)#misc#set_sensitive false + gui#label_airframe#set_text ""; + gui#label_flight_plan#set_text ""; + gui#button_clean#misc#set_sensitive false; + gui#button_build#misc#set_sensitive false; + (Gtk_tools.combo_widget target_combo)#misc#set_sensitive false in Gtk_tools.combo_connect ac_combo update_params; @@ -275,19 +298,22 @@ let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo -> let colorname = string_of_gdkcolor csd#colorsel#color in gui#eventbox_gui_color#misc#modify_bg [`NORMAL, `NAME colorname]; current_color := colorname; - save_callback gui ac_combo (); + save_callback gui ac_combo model (); csd#destroy () in ignore (csd#ok_button#connect#clicked ~callback); ignore (csd#cancel_button#connect#clicked ~callback:csd#destroy) in ignore(gui#button_gui_color#connect#clicked ~callback); (* A/C id *) - ignore(gui#entry_ac_id#connect#changed ~callback:(fun () -> save_callback gui ac_combo ())); + ignore(gui#entry_ac_id#connect#changed ~callback:(fun () -> save_callback gui ac_combo model ())); (* Conf *) - List.iter (fun (name, subdir, label, button_browse, button_edit, editor, multiple) -> + List.iter (fun (name, subdir, label, button_browse, button_edit, editor, remove) -> let callback = fun _ -> - let rel_files = Str.split regexp_space label#text in + let rel_files = match label with + Label l -> Str.split regexp_space l#text + | Tree t -> Str.split regexp_space (Gtk_tools.tree_values t) + in let abs_files = List.map (Filename.concat Utils.conf_dir) rel_files in let quoted_files = List.map (fun s -> "'"^s^"'") abs_files in let arg = String.concat " " quoted_files in @@ -295,17 +321,35 @@ let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo -> ignore (button_edit#connect#clicked ~callback); let callback = fun _ -> let cb = fun names -> - let names = String.concat " " names in - label#set_text names; - save_callback gui ac_combo () + ignore (match label with + Label l -> + let names = String.concat " " names in + l#set_text names + | Tree t -> + List.iter (fun n -> Gtk_tools.add_to_tree t n) names + ); + save_callback gui ac_combo model () in - Utils.choose_xml_file ~multiple name subdir cb in - ignore (button_browse#connect#clicked ~callback)) - (ac_files gui); + Utils.choose_xml_file name subdir cb in + ignore (button_browse#connect#clicked ~callback); + ignore (match remove with + Some r -> + let callback = fun _ -> + match label with + Tree t -> + Gtk_tools.remove_selected_from_tree t; + save_callback gui ac_combo model () + | _ -> () + in + ignore (r#connect#clicked ~callback) + | _ -> () + ) + ) + (ac_files gui model); (* Save button *) - ignore(gui#menu_item_save_ac#connect#activate ~callback:(save_callback ~user_save:true gui ac_combo)) + ignore(gui#menu_item_save_ac#connect#activate ~callback:(save_callback ~user_save:true gui ac_combo model)) let build_handler = fun ~file gui ac_combo (target_combo:Gtk_tools.combo) (log:string->unit) ->