diff --git a/.github/workflows/build-stability.yml b/.github/workflows/build-stability.yml new file mode 100644 index 0000000..dadc555 --- /dev/null +++ b/.github/workflows/build-stability.yml @@ -0,0 +1,43 @@ +name: Liquids (ENGINE) Stability Check +run-name: ${{ github.actor }} is verifying build stability 🚀 +on: + pull_request: + push: + branches: + - main + - development/** + - integration/** + - personal/ES/** +jobs: + Check-build-stability: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }}." + - name: Check out dependencies + uses: fiam/arm-none-eabi-gcc@v1 + with: + release: '9-2019-q4' # The arm-none-eabi-gcc release to use. + - name: Check out repository code + uses: actions/checkout@v4 + with: + submodules: 'true' + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - name: Build hotfire application + run: | + cd app/hotfire/rev5 + make + - name: Build terminal application + run: | + cd app/terminal/rev5 + make + - name: Build ping application + run: | + cd app/ping/rev5 + make + - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 2707dec..33f3143 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "Unity"] - path = Unity - url = https://github.com/ThrowTheSwitch/Unity.git [submodule "mod"] path = mod url = git@github.com:SunDevilRocketry/mod.git [submodule "lib"] path = lib url = git@github.com:SunDevilRocketry/lib.git +[submodule "test"] + path = test + url = git@github.com:SunDevilRocketry/test.git diff --git a/Unity b/Unity deleted file mode 160000 index 3852926..0000000 --- a/Unity +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3852926c00f210905db5feb7a9fa5d5dbf7963ea diff --git a/app/hotfire/rev5/Makefile b/app/hotfire/rev5/Makefile index 9362d6b..8c139ef 100644 --- a/app/hotfire/rev5/Makefile +++ b/app/hotfire/rev5/Makefile @@ -63,6 +63,7 @@ terminal.c \ $(INIT_DIR)/init.c \ $(UTIL_DIR)/sdr_error.c \ $(MOD_DIR)/commands/commands.c \ +$(MOD_DIR)/common/common.c \ $(MOD_DIR)/ignition/ignition.c \ $(MOD_DIR)/led/led.c \ $(MOD_DIR)/power/power.c \ @@ -175,6 +176,7 @@ C_INCLUDES = \ -I$(LIB_DIR)/Drivers/CMSIS/Device/ST/STM32H7xx/Include \ -I$(LIB_DIR)/Drivers/CMSIS/Include \ -I$(MOD_DIR)/commands \ +-I$(MOD_DIR)/common \ -I$(MOD_DIR)/ignition \ -I$(MOD_DIR)/flash \ -I$(MOD_DIR)/led \ diff --git a/app/hotfire/rev5/disarm.c b/app/hotfire/rev5/disarm.c index cc5d3ce..7d64511 100644 --- a/app/hotfire/rev5/disarm.c +++ b/app/hotfire/rev5/disarm.c @@ -24,7 +24,7 @@ #include "pressure.h" #include "sensor.h" #include "sdr_error.h" - +#include "led.h" /*------------------------------------------------------------------------------ Global Variables @@ -85,12 +85,13 @@ memset( &sensor_data, 0, sizeof( SENSOR_DATA ) ); DISARM Sequence ------------------------------------------------------------------------------*/ -/* Open Vent solenoids */ -vc_open_solenoids( SOLENOID_LOX_VENT | SOLENOID_FUEL_VENT ); +// /* Open Vent solenoids */ +// vc_open_solenoids( SOLENOID_LOX_VENT | SOLENOID_FUEL_VENT ); -/* Close purge solenoids */ -vc_close_solenoids( SOLENOID_LOX_PURGE | SOLENOID_FUEL_PURGE ); +// /* Close purge solenoids */ +// vc_close_solenoids( SOLENOID_LOX_PURGE | SOLENOID_FUEL_PURGE ); +led_set_color(LED_YELLOW); /* Wait for disarm command */ while ( !stop_purge_flag ){} diff --git a/app/hotfire/rev5/fire.c b/app/hotfire/rev5/fire.c index 563877d..5a9759a 100644 --- a/app/hotfire/rev5/fire.c +++ b/app/hotfire/rev5/fire.c @@ -5,6 +5,7 @@ * * DESCRIPTION: * Control the engine during hotfire + Update: This will execute a new proposed 2 second hot-fire * *******************************************************************************/ @@ -70,35 +71,33 @@ memset( &sensor_data, 0, sizeof( sensor_data ) ); ------------------------------------------------------------------------------*/ -/* Close the vent solenoids */ -vc_close_solenoids( SOLENOID_LOX_VENT | SOLENOID_FUEL_VENT ); -HAL_Delay( VENT_PRESS_DELAY ); - -/* Pressurize the LOX tank */ +/* Close LOx Vent and Open LOx Pressurization Valve */ +vc_close_solenoids( SOLENOID_LOX_VENT ); +HAL_Delay( 500 ); vc_open_solenoids( SOLENOID_LOX_PRESS ); -HAL_Delay( TANK_PRESS_DELAY ); +HAL_Delay( 8000 ); -/* Pressurize the fuel tank */ +/* Close Fuel Vent and Open Fuel Press Valve */ +vc_close_solenoids( SOLENOID_FUEL_VENT ); vc_open_solenoids( SOLENOID_FUEL_PRESS ); -HAL_Delay( TANK_PRESS_DELAY ); - -/* Crack the main LOX valve */ -vc_crack_main_valves( MAIN_VALVE_LOX_MAIN ); -HAL_Delay( LOX_CRACK_DURATION ); -vc_close_main_valves( MAIN_VALVE_LOX_MAIN ); -HAL_Delay( LOX_POSTCRACK_DELAY ); +HAL_Delay( 12000 ); -/* Ignite the engine */ +/* Ignite the solid propellant Ignitor */ ign_ignite(); -HAL_Delay( ENGINE_IGNITION_DELAY ); +HAL_Delay( 500 ); -/* Open the main valves */ -vc_open_main_valves( MAIN_VALVE_BOTH_MAINS ); +/* Full Speed Open LOx Main Valve */ +vc_open_main_valves( MAIN_VALVE_LOX_MAIN ); +HAL_Delay( 500 ); +/* Gradually Open Fuel Main Valve */ +// TODO +vc_open_main_valves( MAIN_VALVE_FUEL_MAIN ); +// HAL_Delay( 2250 ); /* Engine Burn */ data_logger_init_timer(); burn_time = data_logger_get_time(); -while ( burn_time < ENGINE_BURN_DURATION ) +while ( burn_time < 2000 ) { /* Poll for abort */ if ( fsm_state == FSM_ABORT_STATE ) @@ -121,17 +120,64 @@ while ( burn_time < ENGINE_BURN_DURATION ) burn_time = data_logger_get_time(); } -/* Close the main valves */ -vc_close_main_valves( MAIN_VALVE_BOTH_MAINS ); +/* Close LOx Main Valve and Open LOx Purge*/ +vc_close_main_valves( MAIN_VALVE_LOX_MAIN ); +vc_open_solenoids( SOLENOID_LOX_PURGE ); +HAL_Delay( 150 ); + +/* Close Fuel Main Valve and Open Fuel Purge*/ +vc_close_main_valves( MAIN_VALVE_FUEL_MAIN ); +HAL_Delay( 1500 ); +vc_open_solenoids( SOLENOID_FUEL_PURGE ); +/* Close Fuel and LOx Press */ +vc_close_solenoids( SOLENOID_FUEL_PRESS | SOLENOID_LOX_PRESS ); +/* Open Fuel and LOx Vent */ +vc_open_solenoids( SOLENOID_FUEL_VENT | SOLENOID_LOX_VENT ); +/* Purge Duration*/ +HAL_Delay( 5000 ); + + +/* Close Fuel and LOx Purge */ +vc_close_solenoids( SOLENOID_FUEL_PURGE | SOLENOID_LOX_PURGE ); + + +// /* Engine Burn */ +// data_logger_init_timer(); +// burn_time = data_logger_get_time(); +// while ( burn_time < ENGINE_BURN_DURATION ) +// { +// /* Poll for abort */ +// if ( fsm_state == FSM_ABORT_STATE ) +// { +// return FSM_ABORT_STATE; +// } + +// /* Poll for stop fire command */ +// if ( stop_hotfire_flag ) +// { +// break; +// } + +// /* Log Data */ +// data_logger_get_data( &sensor_data ); +// data_logger_log_data( sensor_data ); + + +// /* Update timer */ +// burn_time = data_logger_get_time(); +// } + +// /* Close the main valves */ +// vc_close_main_valves( MAIN_VALVE_BOTH_MAINS ); -/* Close the pressuriztion solenoids */ -vc_close_solenoids( SOLENOID_LOX_PRESS | SOLENOID_FUEL_PRESS ); +// /* Close the pressuriztion solenoids */ +// vc_close_solenoids( SOLENOID_LOX_PRESS | SOLENOID_FUEL_PRESS ); -/* Open the purge solenoids */ -vc_open_solenoids( SOLENOID_LOX_PURGE | SOLENOID_FUEL_PURGE ); +// /* Open the purge solenoids */ +// vc_open_solenoids( SOLENOID_LOX_PURGE | SOLENOID_FUEL_PURGE ); -/* Wait for stop purge command or timeout */ -HAL_Delay( POSTFIRE_PURGE_DURATION ); +// /* Wait for stop purge command or timeout */ +// HAL_Delay( POSTFIRE_PURGE_DURATION ); /* Transition to disarm state */ return FSM_DISARM_STATE; diff --git a/app/hotfire/rev5/main.c b/app/hotfire/rev5/main.c index 968ad1b..e0cae65 100644 --- a/app/hotfire/rev5/main.c +++ b/app/hotfire/rev5/main.c @@ -71,6 +71,10 @@ volatile bool telreq_wait_flag = false; /* Controller busy */ /* Sensor data */ SENSOR_DATA_PING_PONG sensor_ping_pong_buffer = {0}; +/* Timing */ +volatile uint32_t previous_time; +volatile uint32_t tdelta; + /*------------------------------------------------------------------------------ Application entry point diff --git a/app/ping/rev5/Makefile b/app/ping/rev5/Makefile index c8e7959..ea858df 100644 --- a/app/ping/rev5/Makefile +++ b/app/ping/rev5/Makefile @@ -73,6 +73,7 @@ $(LIB_DIR)/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c \ $(LIB_DIR)/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c \ $(LIB_DIR)/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c \ $(LIB_DIR)/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c \ +$(MOD_DIR)/common/common.c \ $(MOD_DIR)/led/led.c \ $(MOD_DIR)/rs485/rs485.c \ $(MOD_DIR)/usb/usb.c \ @@ -145,6 +146,7 @@ C_INCLUDES = \ -I$(INIT_DIR)/config/Inc \ -I$(LIB_DIR) \ -I$(MOD_DIR)/commands \ +-I$(MOD_DIR)/common \ -I$(MOD_DIR)/led \ -I$(MOD_DIR)/rs485 \ -I$(MOD_DIR)/usb \ diff --git a/app/ping/rev5/main.c b/app/ping/rev5/main.c index 70e4431..9e76097 100644 --- a/app/ping/rev5/main.c +++ b/app/ping/rev5/main.c @@ -48,6 +48,10 @@ UART_HandleTypeDef huart1; /* USB UART handler struct */ UART_HandleTypeDef huart2; /* Valve controller UART handle */ UART_HandleTypeDef huart4; /* Wireless interface UART handle */ +/* Timing */ +volatile uint32_t previous_time; +volatile uint32_t tdelta; + /*------------------------------------------------------------------------------ Application entry point diff --git a/app/terminal/rev5/Makefile b/app/terminal/rev5/Makefile index 7cae405..c3911a5 100644 --- a/app/terminal/rev5/Makefile +++ b/app/terminal/rev5/Makefile @@ -49,6 +49,7 @@ main.c \ $(INIT_DIR)/init.c \ $(UTIL_DIR)/sdr_error.c \ $(MOD_DIR)/commands/commands.c \ +$(MOD_DIR)/common/common.c \ $(MOD_DIR)/ignition/ignition.c \ $(MOD_DIR)/led/led.c \ $(MOD_DIR)/power/power.c \ @@ -160,6 +161,7 @@ C_INCLUDES = \ -I$(LIB_DIR)/Drivers/CMSIS/Device/ST/STM32H7xx/Include \ -I$(LIB_DIR)/Drivers/CMSIS/Include \ -I$(MOD_DIR)/commands \ +-I$(MOD_DIR)/common \ -I$(MOD_DIR)/ignition \ -I$(MOD_DIR)/flash \ -I$(MOD_DIR)/led \ diff --git a/app/terminal/rev5/main.c b/app/terminal/rev5/main.c index fb9fb12..7beee09 100644 --- a/app/terminal/rev5/main.c +++ b/app/terminal/rev5/main.c @@ -55,6 +55,15 @@ UART_HandleTypeDef huart2; /* Valve controller UART handle */ UART_HandleTypeDef huart4; /* Wireless interface UART handle */ +/*------------------------------------------------------------------------------ + Global Variables +------------------------------------------------------------------------------*/ + +/* Timing */ +volatile uint32_t previous_time; +volatile uint32_t tdelta; + + /*------------------------------------------------------------------------------ Application entry point ------------------------------------------------------------------------------*/ diff --git a/lib b/lib index e1b5252..5dd874a 160000 --- a/lib +++ b/lib @@ -1 +1 @@ -Subproject commit e1b5252e5a92fbad1d18617da64b8e0dec4d4cd7 +Subproject commit 5dd874aaaca58c4c43a67c6a8d94b145512c0687 diff --git a/mod b/mod index d6d443e..733ba01 160000 --- a/mod +++ b/mod @@ -1 +1 @@ -Subproject commit d6d443ec5538f4876a3983c4b0f6f93e670f31bb +Subproject commit 733ba016552a81dd09cb9919f303996204b6c425 diff --git a/test b/test new file mode 160000 index 0000000..1bba74d --- /dev/null +++ b/test @@ -0,0 +1 @@ +Subproject commit 1bba74d221573b3443f2861adda6904b57b29a1b diff --git a/test/mock/lib/Drivers/STM32H7xx_HAL_Driver/Src/mock_stm32h7xx_hal_uart.c b/test/mock/lib/Drivers/STM32H7xx_HAL_Driver/Src/mock_stm32h7xx_hal_uart.c deleted file mode 100644 index ae4b975..0000000 --- a/test/mock/lib/Drivers/STM32H7xx_HAL_Driver/Src/mock_stm32h7xx_hal_uart.c +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* -* -* FILE: -* mock_stm32h7xx_hal_uart.c -* -* DESCRIPTION: -* Contains mock/stub functions for functions in stm32h7xx_hal_uart.c -* -*******************************************************************************/ - - -/*------------------------------------------------------------------------------ - Standard Includes -------------------------------------------------------------------------------*/ -#include - - -/*------------------------------------------------------------------------------ - Project Includes -------------------------------------------------------------------------------*/ -#include "stm32h7xx_hal.h" -#include "stm32h7xx_hal_conf.h" - - -/*------------------------------------------------------------------------------ - Global Variables -------------------------------------------------------------------------------*/ - -/* MOCK return values */ -static HAL_StatusTypeDef return_val__HAL_UART_Transmit = 0; - - -/*------------------------------------------------------------------------------ - Internal function prototypes -------------------------------------------------------------------------------*/ - -/*------------------------------------------------------------------------------ - API Functions -------------------------------------------------------------------------------*/ - - -/******************************************************************************* -* * -* PROCEDURE: * -* HAL_UART_Transmit * -* * -* DESCRIPTION: * -* Send an amount of data in blocking mode * -* * -*******************************************************************************/ -HAL_StatusTypeDef HAL_UART_Transmit - ( - UART_HandleTypeDef* huart, - const uint8_t* pData, - uint16_t Size , - uint32_t Timeout - ) -{ -return return_val__HAL_UART_Transmit; -} /* HAL_UART_Transmit*/ - - -/******************************************************************************* -* END OF FILE * -*******************************************************************************/ diff --git a/test/mock/terminal/rev4/main.h b/test/mock/terminal/rev4/main.h deleted file mode 100644 index 4be9bbc..0000000 --- a/test/mock/terminal/rev4/main.h +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* -* -* FILE: -* main.h -* -* DESCRIPTION: -* Processes commands recieved from a host PC, provides fine control over -* engine controller hardware resources -* -*******************************************************************************/ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MAIN_H -#define __MAIN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*------------------------------------------------------------------------------ - Macros -------------------------------------------------------------------------------*/ - -/* General MCU HAL related macros */ -#define HAL_DEFAULT_TIMEOUT ( 1 ) /* Default timeout for polling - operations */ -#define DEF_BUFFER_SIZE ( 16 ) /* Default size of buffer arrays */ - -/*------------------------------------------------------------------------------ - MCU Pin Assignments -------------------------------------------------------------------------------*/ - -/*-------------------------------- Pins --------------------------------------*/ - -/* LED */ -#define STATUS_B_PIN GPIO_PIN_12 -#define STATUS_G_PIN GPIO_PIN_11 -#define STATUS_R_PIN GPIO_PIN_10 - -/* Ignition */ -#define FIRE_PIN GPIO_PIN_6 -#define E_CONT_PIN GPIO_PIN_7 -#define NOZ_CONT_PIN GPIO_PIN_8 -#define SP_CONT_PIN GPIO_PIN_9 - -/* Power */ -#define PWR_SRC_PIN GPIO_PIN_0 - -/* External Flash */ -#define FLASH_SS_PIN GPIO_PIN_12 -#define FLASH_SCK_PIN GPIO_PIN_10 -#define FLASH_MISO_PIN GPIO_PIN_14 -#define FLASH_MOSI_PIN GPIO_PIN_15 -#define FLASH_WP_PIN GPIO_PIN_12 -#define FLASH_HOLD_PIN GPIO_PIN_13 - -/* Pressure transducers */ -#define PRESSURE_GAIN0_PIN GPIO_PIN_0 -#define PRESSURE_GAIN1_PIN GPIO_PIN_1 -#define PRESSURE_GAIN2_PIN GPIO_PIN_3 -#define PRESSURE_GAIN3_PIN GPIO_PIN_4 -#define PRESSURE_GAIN4_PIN GPIO_PIN_5 -#define PRESSURE_GAIN5_PIN GPIO_PIN_6 -#define PRESSURE_GAIN6_PIN GPIO_PIN_7 -#define PRESSURE_GAIN7_PIN GPIO_PIN_8 -#define PRESSURE_GAIN_ALL_PINS ( (uint16_t) 0x01FB ) -#define PRESSURE_MUXA_PIN GPIO_PIN_9 -#define PRESSURE_MUXB_PIN GPIO_PIN_10 -#define PRESSURE_MUXC_PIN GPIO_PIN_11 -#define PRESSURE_MUX_ALL_PINS ( (uint16_t) 0x0E00 ) - -/*-------------------------------- Ports--------------------------------------*/ - -/* LED */ -#define STATUS_GPIO_PORT GPIOE - -/* Ignition */ -#define FIRE_GPIO_PORT GPIOE -#define E_CONT_GPIO_PORT GPIOE -#define NOZ_CONT_GPIO_PORT GPIOE -#define SP_CONT_GPIO_PORT GPIOE - -/* Power */ -#define PWR_SRC_GPIO_PORT GPIOE - -/* External Flash */ -#define FLASH_SS_GPIO_PORT GPIOB -#define FLASH_SCK_GPIO_PORT GPIOB -#define FLASH_MISO_GPIO_PORT GPIOB -#define FLASH_MOSI_GPIO_PORT GPIOB -#define FLASH_WP_GPIO_PORT GPIOD -#define FLASH_HOLD_GPIO_PORT GPIOD - -/* Pressure transducers */ -#define PRESSURE_GPIO_PORT GPIOD - - -/*------------------------------------------------------------------------------ - Exported functions prototypes -------------------------------------------------------------------------------*/ -void Error_Handler(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __MAIN_H */ diff --git a/test/mock/terminal/rev4/mod/led/led.h b/test/mock/terminal/rev4/mod/led/led.h deleted file mode 100644 index 1093489..0000000 --- a/test/mock/terminal/rev4/mod/led/led.h +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* -* -* FILE: -* led.h -* -* DESCRIPTION: -* Contains API functions to set the behavior of the on-board rgb led -* -*******************************************************************************/ - - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef LED_H -#define LED_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*------------------------------------------------------------------------------ - Typdefs -------------------------------------------------------------------------------*/ - - -/*------------------------------------------------------------------------------ - Macros -------------------------------------------------------------------------------*/ - - -/*------------------------------------------------------------------------------ - Function Prototypes -------------------------------------------------------------------------------*/ - -/* Display Red to indicate software exception */ -void led_error_assert - ( - void - ); - -/* Sets the RGB LED to blue to be triggered during debugging */ -void led_debug_assert - ( - void - ); - -/* Reset the led */ -void led_reset - ( - void - ); - -/* Flash Red to indicate that the code hit a block of code not meant to be run - without blocking the program from running */ -void led_error_flash - ( - void - ); - -/* Flash the RGB led */ -void led_flash - ( - void - ); - - -#endif /* LED_H */ diff --git a/test/mock/terminal/rev4/mod/pressure/mock_pressure.c b/test/mock/terminal/rev4/mod/pressure/mock_pressure.c deleted file mode 100644 index 35142b9..0000000 --- a/test/mock/terminal/rev4/mod/pressure/mock_pressure.c +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* -* -* FILE: -* mock_pressure.c -* -* DESCRIPTION: -* Contains mock/stub functions for functions in pressure.c -* -*******************************************************************************/ - - -/*------------------------------------------------------------------------------ - Standard Includes -------------------------------------------------------------------------------*/ -#include - -/*------------------------------------------------------------------------------ - Project Includes -------------------------------------------------------------------------------*/ -#include "pressure.h" - -/*------------------------------------------------------------------------------ - Global Variables -------------------------------------------------------------------------------*/ - -/* MOCK return values */ -static uint32_t return_val__pressure_get_pt_reading = 0; -static PRESSURE_STATUS return_val__pressure_poll_pts = 0; -static uint8_t return_val__pressure_get_gain = 0; -static uint16_t return_val__mux_map = 0; -static PRESSURE_STATUS return_val__sample_adc_poll = 0; -static uint16_t return_val__amplifier_gain_map = 0; - -/* Amplifier gain settings */ -static uint8_t pt_gains[] = { 0, 0, 0, 0, 0, 0, 0, 0 } ; - - -/*------------------------------------------------------------------------------ - Internal function prototypes -------------------------------------------------------------------------------*/ - -/* PT number to GPIO pin butmask mapping */ -static inline uint16_t mux_map - ( - PRESSURE_PT_NUM pt_num - ); - -/* Sample ADC in polling mode */ -static PRESSURE_STATUS sample_adc_poll - ( - uint16_t num_samples, - uint32_t* psample_buffer - ); - -/* Mapping from PT number to amplifer gain GPIO pin bitmask */ -static uint16_t amplifier_gain_map - ( - uint8_t gain_setting - ); - - -/*------------------------------------------------------------------------------ - API Functions -------------------------------------------------------------------------------*/ - - -/******************************************************************************* -* * -* PROCEDURE: * -* pressure_get_pt_reading * -* * -* DESCRIPTION: * -* Get a single pressure transducer reading * -* * -*******************************************************************************/ -uint32_t pressure_get_pt_reading - ( - PRESSURE_PT_NUM pt_num - ) -{ -return return_val__pressure_get_pt_reading; -} /* pressure_get_pt_reading */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* pressure_poll_pts * -* * -* DESCRIPTION: * -* Get readings from all pressure transducers * -* * -*******************************************************************************/ -PRESSURE_STATUS pressure_poll_pts - ( - uint32_t* pPT_readings /* array of size NUM_PTS */ - ) -{ -return return_val__pressure_poll_pts; -} /* pressure_poll_pts */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* pressure_set_gain * -* * -* DESCRIPTION: * -* Set the amplifier gain for a single pressure transducer * -* * -*******************************************************************************/ -void pressure_set_gain - ( - PRESSURE_PT_NUM pt_num, - uint8_t gain - ) -{ - -} /* pressure_set_gain */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* pressure_set_all_gains * -* * -* DESCRIPTION: * -* Set the amplifier gain for all pressure transducers * -* * -*******************************************************************************/ -void pressure_set_all_gains - ( - uint8_t gains[] - ) -{ - -} /* pressure_set_gains */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* pressure_get_gain * -* * -* DESCRIPTION: * -* Get the gain for a single pressure transducer * -* * -*******************************************************************************/ -uint8_t pressure_get_gain - ( - PRESSURE_PT_NUM pt_num - ) -{ -return return_val__pressure_get_gain; -} /* pressure_get_gain */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* pressure_get_all_gains * -* * -* DESCRIPTION: * -* Get the gain for all pressure transducers * -* * -*******************************************************************************/ -void pressure_get_all_gains - ( - uint8_t* pgains - ) -{ - -} /* pressure_get_all_gains */ - - -/*------------------------------------------------------------------------------ - Internal procedures -------------------------------------------------------------------------------*/ - - -/******************************************************************************* -* * -* PROCEDURE: * -* amplifer_gain_map * -* * -* DESCRIPTION: * -* Mapping from pressure transducer number to amplifer gain GPIO pin * -* bitmask. ex. gain setting 128 -> PRESSURE_GAIN7_PIN * -* * -*******************************************************************************/ -static uint16_t amplifier_gain_map - ( - uint8_t gain_setting - ) -{ -return return_val__amplifier_gain_map; -} /* amplifier_gain_map */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* mux_map * -* * -* DESCRIPTION: * -* Mapping from pressure transducer number to mutliplexor GPIO pin * -* bitmask. ex. PTNUM5 -> 101 -> GPIO_PIN_C | GPIO_PIN_A * -* * -*******************************************************************************/ -static inline uint16_t mux_map - ( - PRESSURE_PT_NUM pt_num - ) -{ -return return_val__mux_map; -} /* mux_map */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* sample_adc_poll * -* * -* DESCRIPTION: * -* Sample the pressure transducer ADC a specified number of times in * -* polling mode * -* * -*******************************************************************************/ -static PRESSURE_STATUS sample_adc_poll - ( - uint16_t num_samples, - uint32_t* psample_buffer - ) -{ -return return_val__sample_adc_poll; -} /* sample_adc_poll */ - - -/******************************************************************************* -* END OF FILE * -*******************************************************************************/ diff --git a/test/terminal/rev4/mod/sensor/Makefile b/test/terminal/rev4/mod/sensor/Makefile deleted file mode 100644 index 944c0b9..0000000 --- a/test/terminal/rev4/mod/sensor/Makefile +++ /dev/null @@ -1,134 +0,0 @@ -################################################################ -# -# sensor.c unit tests (based on gcc) -# -################################################################ - - -################################################################ -# target -################################################################ -TARGET = test_sensor - - -################################################################ -# build variables -################################################################ - -# Debug build? -DEBUG = 1 -# Optimization -OPT = -Og - - -################################################################ -# paths -################################################################ - -# build folder -BUILD_DIR = build - -# base directory -ROOT_DIR = ../../../../.. - -# terminal directory -TERMINAL_DIR = $(ROOT_DIR)/terminal/rev4 - -# terminal mocked directory -MOCK_DIR = $(ROOT_DIR)/unit_tests/mock/terminal/rev4 - -# library directory -LIB_DIR = $(ROOT_DIR)/lib - - -################################################################ -# source -################################################################ - -# C sources -C_SOURCES = \ -test_sensor.c \ -$(ROOT_DIR)/Unity/src/unity.c \ -$(MOCK_DIR)/mod/pressure/mock_pressure.c \ -$(ROOT_DIR)/unit_tests/mock/lib/Drivers/STM32H7xx_HAL_Driver/Src/mock_stm32h7xx_hal_uart.c - - -################################################################ -# Compiler -################################################################ -CC = gcc - - -################################################################ -# C flags -################################################################ - -# C Includes -C_INCLUDES = \ --I. \ --I$(TERMINAL_DIR) \ --I$(TERMINAL_DIR)/config/Inc \ --I$(LIB_DIR)/Drivers/STM32H7xx_HAL_Driver/Inc \ --I$(LIB_DIR)/Drivers/STM32H7xx_HAL_Driver/Inc/Legacy \ --I$(LIB_DIR)/Drivers/CMSIS/Device/ST/STM32H7xx/Include \ --I$(LIB_DIR)/Drivers/CMSIS/Include \ --I$(TERMINAL_DIR)/mod/commands/ \ --I$(TERMINAL_DIR)/mod/ignition/ \ --I$(TERMINAL_DIR)/mod/led/ \ --I$(TERMINAL_DIR)/mod/power/ \ --I$(TERMINAL_DIR)/mod/flash/ \ --I$(TERMINAL_DIR)/mod/pressure/ \ --I$(TERMINAL_DIR)/mod/sensor/ \ --I$(ROOT_DIR)/Unity/src/ \ --I$(MOCK_DIR) - -# Preprocessor definitions -C_DEFS = \ --DUSE_HAL_DRIVER \ --DSTM32H750xx \ --DUNIT_TEST - -CFLAGS = $(C_INCLUDES) $(C_DEFS) $(OPT) -Wall -g - -# Disable some warnings -CFLAGS += -Wno-pointer-to-int-cast -CFLAGS += -Wno-int-to-pointer-cast -CFLAGS += -Wno-unused-function -CFLAGS += -Wno-unused-variable - -# build all -all: $(BUILD_DIR)/$(TARGET) - - -################################################################ -# Build the application -################################################################ - -# Setup the path for c files -OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) -vpath %.c $(sort $(dir $(C_SOURCES))) - -$(BUILD_DIR)/%.o: %.c $(BUILD_DIR) - $(CC) -c $(CFLAGS) $< -o $@ - -$(BUILD_DIR)/$(TARGET): $(OBJECTS) - $(CC) $(OBJECTS) -o $@ - -$(BUILD_DIR): - mkdir $@ - -test: - echo "$(BUILD_DIR)" - - -################################################################ -# clean up -################################################################ - -clean: - -rm -fR $(BUILD_DIR) - - -################################################################ -# EOF -################################################################ diff --git a/test/terminal/rev4/mod/sensor/run_test.py b/test/terminal/rev4/mod/sensor/run_test.py deleted file mode 100644 index c5adda2..0000000 --- a/test/terminal/rev4/mod/sensor/run_test.py +++ /dev/null @@ -1,3 +0,0 @@ -import subprocess - -subprocess.run(["build/test_sensor"]) diff --git a/test/terminal/rev4/mod/sensor/test_cases/readings_to_bytes.txt b/test/terminal/rev4/mod/sensor/test_cases/readings_to_bytes.txt deleted file mode 100644 index d25b927..0000000 --- a/test/terminal/rev4/mod/sensor/test_cases/readings_to_bytes.txt +++ /dev/null @@ -1,2 +0,0 @@ -{{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}, -{{236,236,236,236,236,236,236,236,236,236},{0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0xec}} diff --git a/test/terminal/rev4/mod/sensor/test_sensor.c b/test/terminal/rev4/mod/sensor/test_sensor.c deleted file mode 100644 index 772985d..0000000 --- a/test/terminal/rev4/mod/sensor/test_sensor.c +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* -* -* FILE: -* test_sensor.c -* -* DESCRIPTION: -* Unit tests for functions in the sensor module -* -*******************************************************************************/ - -/*------------------------------------------------------------------------------ -Standard Includes -------------------------------------------------------------------------------*/ -#include -#include - - -/*------------------------------------------------------------------------------ -Project Includes -------------------------------------------------------------------------------*/ -#include "unity.h" -#include "main.h" - -/* CMSIS/HAL */ -#include "stm32h7xx_hal.h" -#include "stm32h7xx_hal_conf.h" - -/* File under test */ -#include "sensor.c" - - -/*------------------------------------------------------------------------------ -Macros -------------------------------------------------------------------------------*/ -#define NUM_TESTS_readings_to_bytes ( 2 ) - - -/*------------------------------------------------------------------------------ -Global Variables -------------------------------------------------------------------------------*/ -UART_HandleTypeDef huart1; /* USB UART handler struct */ - - -/*------------------------------------------------------------------------------ -Function Prototypes -------------------------------------------------------------------------------*/ - -/* Code to run prior to any test */ -void setUp - ( - void - ); - -/* Code to run after tests */ -void tearDown - ( - void - ); - -/* tests the reading_to_bytes function in sensor.c */ -void test_readings_to_bytes - ( - void - ); - - -/*------------------------------------------------------------------------------ -Types -------------------------------------------------------------------------------*/ - -/* readings_to_bytes test data type */ -typedef struct - { - uint32_t Src_buffer[ NUM_SENSORS ]; - uint8_t Dst_buffer[ 4*NUM_SENSORS ]; - } readings_to_bytes__test_type; - - -/*------------------------------------------------------------------------------ -Procedures -------------------------------------------------------------------------------*/ - - -/******************************************************************************* -* * -* PROCEDURE: * -* setUp * -* * -* DESCRIPTION: * -* Code to run prior to any test * -* * -*******************************************************************************/ -void setUp - ( - void - ) -{ -} /* setUp */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* tearDown * -* * -* DESCRIPTION: * -* Code to run after tests * -* * -*******************************************************************************/ -void tearDown - ( - void - ) -{ -} /* tearDown */ - - -/******************************************************************************* -* * -* PROCEDURE: * -* test_readings_to_bytes * -* * -* DESCRIPTION: * -* tests the reading_to_bytes function in sensor.c * -* * -*******************************************************************************/ -void test_readings_to_bytes - ( - void - ) -{ -/*------------------------------------------------------------------------------ -Local Variables -------------------------------------------------------------------------------*/ -uint8_t Dst_buffer[ 4*NUM_SENSORS ]; -uint32_t Src_buffer[ NUM_SENSORS ]; -uint8_t return_val[ 4*NUM_SENSORS ]; - -/*------------------------------------------------------------------------------ -Initializations -------------------------------------------------------------------------------*/ -readings_to_bytes__test_type test_data[] = -{ -#include "test_cases/readings_to_bytes.txt" -}; - -/*------------------------------------------------------------------------------ -Run Tests -------------------------------------------------------------------------------*/ -for ( int test_num = 0; test_num < NUM_TESTS_readings_to_bytes; ++test_num ) - { - /* Initialize input/output */ - memcpy( &Src_buffer[0], &( test_data[test_num].Src_buffer[0] ), sizeof( Src_buffer ) ); - memcpy( &Dst_buffer[0], &( test_data[test_num].Dst_buffer[0] ), sizeof( Dst_buffer ) ); - memset( &return_val[0], 0 , sizeof( return_val ) ); - - /* Call the fut */ - readings_to_bytes( &return_val[0], &Src_buffer[0] ); - - /* Verify correct output */ - TEST_ASSERT_EQUAL_UINT8_ARRAY( Dst_buffer, return_val, 4*NUM_SENSORS ); - } - -} /* test_readings_to_bytes */ - - -/*------------------------------------------------------------------------------ -Run Tests -------------------------------------------------------------------------------*/ -int main - ( - void - ) -{ -UNITY_BEGIN(); -RUN_TEST( test_readings_to_bytes ); -return UNITY_END(); -} /* main */ - - -/******************************************************************************* -* END OF FILE * -*******************************************************************************/