diff --git a/Core/Inc/can_handler.h b/Core/Inc/can_handler.h index 9389f671..16ad654a 100644 --- a/Core/Inc/can_handler.h +++ b/Core/Inc/can_handler.h @@ -2,7 +2,7 @@ #define CAN_HANDLER_H #include "can.h" -#include "cmsis_os.h" +#include "ner_cmsis_os.h" /** * @brief Callback to be called when a message is received on CAN line 1. diff --git a/Core/Inc/cell_data_logging.h b/Core/Inc/cell_data_logging.h index 74db2348..2221b389 100644 --- a/Core/Inc/cell_data_logging.h +++ b/Core/Inc/cell_data_logging.h @@ -19,7 +19,7 @@ #include #include "datastructs.h" #include "ringbuffer.h" -#include "cmsis_os.h" +#include "ner_cmsis_os.h" // Number of stored cell data readings in ring buffer. #define NUM_OF_READINGS 10 diff --git a/Core/Inc/compute.h b/Core/Inc/compute.h index 77e61d1d..b3308bd4 100644 --- a/Core/Inc/compute.h +++ b/Core/Inc/compute.h @@ -4,7 +4,7 @@ #include #include -#include "stm32f4xx.h" +#include "stm32xx_hal.h" #define CURRENT_SENSOR_PIN_L A1 #define CURRENT_SENSOR_PIN_H A0 diff --git a/Core/Inc/datastructs.h b/Core/Inc/datastructs.h index c497fff3..76c54bbc 100644 --- a/Core/Inc/datastructs.h +++ b/Core/Inc/datastructs.h @@ -5,7 +5,7 @@ #include #include "bmsConfig.h" #include "timer.h" -#include "cmsis_os2.h" +#include "ner_cmsis_os.h" #include "adBms6830Data.h" /** diff --git a/Core/Inc/main.h b/Core/Inc/main.h index cf40c517..4a040d68 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -27,7 +27,7 @@ extern "C" { #endif /* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx_hal.h" +#include "stm32xx_hal.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ diff --git a/Core/Inc/segment.h b/Core/Inc/segment.h index a19f335e..0c540b24 100644 --- a/Core/Inc/segment.h +++ b/Core/Inc/segment.h @@ -3,11 +3,13 @@ #include "datastructs.h" +typedef bool discharge_config[NUM_CHIPS][NUM_CELLS_ALPHA]; + /** * @brief Initialize chips with default values. - * + * */ -void segment_init(acc_data_t *bmsdata); +void segment_init(acc_data_t *bmsdata); /** * @brief Stop discharge quickly * @@ -72,7 +74,7 @@ void segment_manual_balancing(acc_data_t *bmsdata); * @param discharge_config Array containing the discharge configuration. true = discharge, false = do not discharge. */ void segment_configure_balancing( - acc_data_t *bmsdata, bool discharge_config[NUM_CHIPS][NUM_CELLS_ALPHA]); + acc_data_t *bmsdata, discharge_config dc); /** * @brief Returns if any cells are balancing. @@ -101,18 +103,4 @@ void segment_restart(acc_data_t *bmsdata); */ void get_adc_comparison(acc_data_t *bmsdata); -/** - * @brief Read the serial ID of the chip. - * - * @param chips Array of chips to read. - */ -void read_serial_id(cell_asic chips[NUM_CHIPS]); - -/** - * @brief Read voltages in every register connected to AUX2 ADC. - * - * @param chips Array of chips to get voltages of. - */ -void adc_and_read_aux2_registers(cell_asic chips[NUM_CHIPS]); - #endif \ No newline at end of file diff --git a/Core/Inc/shep_tasks.h b/Core/Inc/shep_tasks.h index 83ed1400..5e7bbffd 100644 --- a/Core/Inc/shep_tasks.h +++ b/Core/Inc/shep_tasks.h @@ -11,7 +11,7 @@ #ifndef SHEP_TASKS_H #define SHEP_TASKS_H -#include "cmsis_os.h" +#include "ner_cmsis_os.h" /** * @brief Task for retrieving segment data diff --git a/Core/Src/cell_data_logging.c b/Core/Src/cell_data_logging.c index 1dcbdd2b..d8280167 100644 --- a/Core/Src/cell_data_logging.c +++ b/Core/Src/cell_data_logging.c @@ -6,7 +6,7 @@ #include "cell_data_logging.h" #include "analyzer.h" #include "bmsConfig.h" -#include "stm32f4xx_hal.h" +#include "stm32xx_hal.h" #include #include #include diff --git a/Core/Src/eepromdirectory.c b/Core/Src/eepromdirectory.c index 3fba17fe..d88ccfd3 100644 --- a/Core/Src/eepromdirectory.c +++ b/Core/Src/eepromdirectory.c @@ -1,5 +1,5 @@ #include "eepromdirectory.h" -#include "stm32f4xx_hal.h" +#include "stm32xx_hal.h" #include "m24c32_eeprom_directory.h" #include "m24c32.h" diff --git a/Drivers/Embedded-Base b/Drivers/Embedded-Base index 2a567018..65b25496 160000 --- a/Drivers/Embedded-Base +++ b/Drivers/Embedded-Base @@ -1 +1 @@ -Subproject commit 2a5670180e6b882c52fc95ad58ca9d9c8cbcf4a7 +Subproject commit 65b25496b8e3605a1fa3899a5621ef35373539c3 diff --git a/Drivers/adbms b/Drivers/adbms index 0a19393a..60c7026c 160000 --- a/Drivers/adbms +++ b/Drivers/adbms @@ -1 +1 @@ -Subproject commit 0a19393a4480c9e92f3a565f618544ea01dfaeb9 +Subproject commit 60c7026c480797367178a03b1bd2e6bf5d904262 diff --git a/Tests/Inc/test_analyzer.h b/Tests/Inc/test_analyzer.h new file mode 100644 index 00000000..f933f724 --- /dev/null +++ b/Tests/Inc/test_analyzer.h @@ -0,0 +1,8 @@ + +#ifndef TEST_ANALYZER_H +#define TEST_ANALYZER_H + +#include "unity.h" +#include "analyzer.h" + +#endif \ No newline at end of file diff --git a/Tests/Inc/test_charging.h b/Tests/Inc/test_charging.h new file mode 100644 index 00000000..f3c856e9 --- /dev/null +++ b/Tests/Inc/test_charging.h @@ -0,0 +1,8 @@ + +#ifndef TEST_CHARGING_H +#define TEST_CHARGING_H + +#include "unity.h" +#include "charging.h" + +#endif \ No newline at end of file diff --git a/Tests/Src/test_analyzer.c b/Tests/Src/test_analyzer.c new file mode 100644 index 00000000..af763ecb --- /dev/null +++ b/Tests/Src/test_analyzer.c @@ -0,0 +1,38 @@ + +#include "unity.h" +#include "mock_stub_functions.h" +#include "datastructs.h" +#include "analyzer.h" +#include +#include + +I2C_HandleTypeDef hi2c1; +ADC_HandleTypeDef hadc1; + +acc_data_t *bmsdata; +chipdata_t *chipdata; + + +void setUp(void) { + bmsdata = malloc(sizeof(acc_data_t)); + chipdata = malloc(sizeof(chipdata_t)); +} + +void tearDown(void) { + free(bmsdata); + free(chipdata); +} + +// A simple random test +void test_random(void) { + chipdata->alpha = true; + TEST_ASSERT_EQUAL_INT(get_num_cells(chipdata), NUM_CELLS_ALPHA); + chipdata->alpha = false; + TEST_ASSERT_EQUAL_INT(get_num_cells(chipdata), NUM_CELLS_BETA); +} + +int main(void) { + UNITY_BEGIN(); + RUN_TEST(test_random); + return UNITY_END(); +} \ No newline at end of file diff --git a/Tests/Src/test_charging.c b/Tests/Src/test_charging.c new file mode 100644 index 00000000..440c53ca --- /dev/null +++ b/Tests/Src/test_charging.c @@ -0,0 +1,34 @@ + +#include "mock_stub_functions.h" +#include "test_charging.h" +#include "datastructs.h" +#include +#include + +I2C_HandleTypeDef hi2c1; +ADC_HandleTypeDef hadc1; + +acc_data_t *bmsdata; +chipdata_t *chipdata; + + +void setUp(void) { + bmsdata = malloc(sizeof(acc_data_t)); + chipdata = malloc(sizeof(chipdata_t)); +} + +void tearDown(void) { + free(bmsdata); + free(chipdata); +} + +// A simple random test +void test_charging(void) { + +} + +int main(void) { + UNITY_BEGIN(); + RUN_TEST(test_charging); + return UNITY_END(); +} \ No newline at end of file diff --git a/Tests/mock_configs/test_analyzer.txt b/Tests/mock_configs/test_analyzer.txt new file mode 100644 index 00000000..795b18b3 --- /dev/null +++ b/Tests/mock_configs/test_analyzer.txt @@ -0,0 +1,6 @@ +Core/Inc/adi_interaction.h +Drivers/adbms/program/inc/serialPrintResult.h +Core/Inc/cell_data_logging.h +Core/Inc/eepromdirectory.h +Drivers/Embedded-Base/general/include/sht30.h +Drivers/adbms/lib/inc/adBms6830ParseCreate.h \ No newline at end of file diff --git a/Tests/mock_configs/test_charging.txt b/Tests/mock_configs/test_charging.txt new file mode 100644 index 00000000..33c058fe --- /dev/null +++ b/Tests/mock_configs/test_charging.txt @@ -0,0 +1,7 @@ +Core/Inc/adi_interaction.h +Drivers/adbms/program/inc/serialPrintResult.h +Core/Inc/cell_data_logging.h +Core/Inc/eepromdirectory.h +Drivers/Embedded-Base/general/include/sht30.h +Drivers/adbms/lib/inc/adBms6830ParseCreate.h +Core/Inc/segment.h \ No newline at end of file