diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 9342123..25b93f3 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -25,7 +25,7 @@ name: Test Workflow on: push: - branches: [ dev_firmware ] + branches: [ dev_firmware, feat_unit_tests ] pull_request: branches: [ master, dev, dev_firmware] diff --git a/firmware/tests/devices/Makefile b/firmware/tests/devices/Makefile index d105202..9af4bba 100644 --- a/firmware/tests/devices/Makefile +++ b/firmware/tests/devices/Makefile @@ -1,4 +1,9 @@ TARGET_LEDS=leds_unit_test +TARGET_CURRENT_SENSOR=current_sensor_unit_test +TARGET_TEMP_SENSOR=temp_sensor_unit_test +TARGET_VOLTAGE_SENSOR=voltage_sensor_unit_test +TARGET_OBDH=obdh_unit_test +TARGET_TTC=ttc_unit_test ifndef BUILD_DIR BUILD_DIR=$(CURDIR) @@ -8,25 +13,108 @@ CC=gcc INC=../../ FLAGS=-fpic -std=c99 -Wall -pedantic -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -I$(INC) -Wl,--wrap=sys_log_print_event_from_module,--wrap=sys_log_new_line,--wrap=sys_log_print_msg,--wrap=sys_log_print_uint,--wrap=sys_log_print_int,--wrap=sys_log_print_float,--wrap=adc_init,--wrap=adc_read,--wrap=adc_temp_get_mref,--wrap=adc_temp_get_nref,--wrap=gpio_init,--wrap=gpio_set_state,--wrap=gpio_get_state,--wrap=gpio_toggle,--wrap=wdt_init,--wrap=wdt_reset,--wrap=tps382x_init,--wrap=tps382x_trigger +CURRENT_SENSOR_TEST_FLAGS=$(FLAGS),--wrap=adc_init,--wrap=adc_read,--wrap=adc_temp_get_mref,--wrap=adc_temp_get_nref,--wrap=adc_mutex_give,--wrap=adc_mutex_take,--wrap=max9934_read,--wrap=max9934_init +VOLTAGE_SENSOR_TEST_FLAGS=$(FLAGS),--wrap=adc_init,--wrap=adc_read,--wrap=adc_temp_get_mref,--wrap=adc_temp_get_nref,--wrap=adc_mutex_give,--wrap=adc_mutex_take +TEMP_SENSOR_TEST_FLAGS=$(FLAGS),--wrap=ads1248_init,--wrap=ads1248_reset,--wrap=ads1248_config_regs,--wrap=ads1248_read_regs,--wrap=ads1248_read_data,--wrap=ads1248_write_cmd,--wrap=ads1248_set_powerdown_mode,--wrap=adc_init,--wrap=adc_read,--wrap=adc_temp_get_mref,--wrap=adc_temp_get_nref,--wrap=adc_mutex_give,--wrap=adc_mutex_take +OBDH_TEST_FLAGS=$(FLAGS),--wrap=tca4311a_init,--wrap=tca4311a_enable,--wrap=tca4311a_disable,--wrap=tca4311a_is_ready,--wrap=i2c_slave_init,--wrap=i2c_slave_set_mode,--wrap=i2c_slave_enable,--wrap=i2c_slave_disable,--wrap=i2c_slave_write,--wrap=i2c_master_init,--wrap=i2c_write,--wrap=i2c_read +TTC_TEST_FLAGS=$(FLAGS),--wrap=uart_interrupt_init,--wrap=uart_interrupt_enable,--wrap=uart_interrupt_disable,--wrap=uart_interrupt_write + .PHONY: all -all: leds_test +all: leds_test current_sensor_test temp_sensor_test voltage_sensor_test obdh_test ttc_test .PHONY: leds_test leds_test: $(BUILD_DIR)/leds.o $(BUILD_DIR)/leds_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/gpio_wrap.o $(CC) $(FLAGS) $(BUILD_DIR)/leds.o $(BUILD_DIR)/leds_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/gpio_wrap.o -o $(BUILD_DIR)/$(TARGET_LEDS) -lcmocka + +.PHONY: current_sensor_test +current_sensor_test: $(BUILD_DIR)/current_sensor.o $(BUILD_DIR)/current_sensor_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/adc_wrap.o $(BUILD_DIR)/max9934_wrap.o + $(CC) $(CURRENT_SENSOR_TEST_FLAGS) $(BUILD_DIR)/current_sensor.o $(BUILD_DIR)/current_sensor_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/adc_wrap.o $(BUILD_DIR)/max9934_wrap.o -o $(BUILD_DIR)/$(TARGET_CURRENT_SENSOR) -lcmocka + +.PHONY: temp_sensor_test +temp_sensor_test: $(BUILD_DIR)/temp_sensor.o $(BUILD_DIR)/temp_sensor_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/ads1248_wrap.o $(BUILD_DIR)/gpio_wrap.o $(BUILD_DIR)/adc_wrap.o + $(CC) $(TEMP_SENSOR_TEST_FLAGS) $(BUILD_DIR)/temp_sensor.o $(BUILD_DIR)/temp_sensor_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/ads1248_wrap.o $(BUILD_DIR)/gpio_wrap.o $(BUILD_DIR)/adc_wrap.o -o $(BUILD_DIR)/$(TARGET_TEMP_SENSOR) -lcmocka + +.PHONY: voltage_sensor_test +voltage_sensor_test: $(BUILD_DIR)/voltage_sensor.o $(BUILD_DIR)/voltage_sensor_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/adc_wrap.o + $(CC) $(VOLTAGE_SENSOR_TEST_FLAGS) $(BUILD_DIR)/voltage_sensor.o $(BUILD_DIR)/voltage_sensor_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/adc_wrap.o -o $(BUILD_DIR)/$(TARGET_VOLTAGE_SENSOR) -lcmocka + +.PHONY: obdh_test +obdh_test: $(BUILD_DIR)/obdh.o $(BUILD_DIR)/obdh_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/tca4311a_wrap.o $(BUILD_DIR)/i2c_slave_wrap.o $(BUILD_DIR)/i2c_wrap.o + $(CC) $(OBDH_TEST_FLAGS) $(BUILD_DIR)/obdh.o $(BUILD_DIR)/obdh_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/tca4311a_wrap.o $(BUILD_DIR)/i2c_slave_wrap.o $(BUILD_DIR)/i2c_wrap.o -o $(BUILD_DIR)/$(TARGET_OBDH) -lcmocka + +.PHONY: ttc_test +ttc_test: $(BUILD_DIR)/ttc.o $(BUILD_DIR)/ttc_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/uart_interrupt_wrap.o + $(CC) $(TTC_TEST_FLAGS) $(BUILD_DIR)/ttc.o $(BUILD_DIR)/ttc_test.o $(BUILD_DIR)/sys_log_wrap.o $(BUILD_DIR)/uart_interrupt_wrap.o -o $(BUILD_DIR)/$(TARGET_TTC) -lcmocka + + +# Devices $(BUILD_DIR)/leds.o: ../../devices/leds/leds.c $(CC) $(FLAGS) -c $< -o $@ +$(BUILD_DIR)/current_sensor.o: ../../devices/current_sensor/current_sensor.c + $(CC) $(CURRENT_SENSOR_TEST_FLAGS) -c $< -o $@ + +$(BUILD_DIR)/temp_sensor.o: ../../devices/temp_sensor/temp_sensor.c + $(CC) $(TEMP_SENSOR_TEST_FLAGS) -c $< -o $@ + +$(BUILD_DIR)/voltage_sensor.o: ../../devices/voltage_sensor/voltage_sensor.c + $(CC) $(VOLTAGE_SENSOR_TEST_FLAGS) -c $< -o $@ + +$(BUILD_DIR)/obdh.o: ../../devices/obdh/obdh.c + $(CC) $(OBDH_TEST_FLAGS) -c $< -o $@ + +$(BUILD_DIR)/ttc.o: ../../devices/ttc/ttc.c + $(CC) $(TTC_TEST_FLAGS) -c $< -o $@ + +# Tests +$(BUILD_DIR)/current_sensor_test.o: current_sensor_test.c + $(CC) $(CURRENT_SENSOR_TEST_FLAGS) -c $< -o $@ + $(BUILD_DIR)/leds_test.o: leds_test.c $(CC) $(FLAGS) -c $< -o $@ -$(BUILD_DIR)/sys_log_wrap.o: ../mockups/sys_log_wrap.c +$(BUILD_DIR)/temp_sensor_test.o: temp_sensor_test.c + $(CC) $(TEMP_SENSOR_TEST_FLAGS) -c $< -o $@ + +$(BUILD_DIR)/voltage_sensor_test.o: voltage_sensor_test.c + $(CC) $(VOLTAGE_SENSOR_TEST_FLAGS) -c $< -o $@ + +$(BUILD_DIR)/obdh_test.o: obdh_test.c + $(CC) $(OBDH_TEST_FLAGS) -c $< -o $@ + +$(BUILD_DIR)/ttc_test.o: ttc_test.c + $(CC) $(TTC_TEST_FLAGS) -c $< -o $@ + +# Mockups +$(BUILD_DIR)/sys_log_wrap.o: ../mockups/sys_log_wrap/sys_log_wrap.c + $(CC) $(FLAGS) -c $< -o $@ + +$(BUILD_DIR)/gpio_wrap.o: ../mockups/gpio_wrap/gpio_wrap.c + $(CC) $(FLAGS) -c $< -o $@ + +$(BUILD_DIR)/adc_wrap.o: ../mockups/adc_wrap/adc_wrap.c + $(CC) $(FLAGS) -c $< -o $@ + +$(BUILD_DIR)/max9934_wrap.o: ../mockups/max9934_wrap/max9934_wrap.c + $(CC) $(FLAGS) -c $< -o $@ + +$(BUILD_DIR)/ads1248_wrap.o: ../mockups/ads1248_wrap/ads1248_wrap.c + $(CC) $(FLAGS) -c $< -o $@ + +$(BUILD_DIR)/tca4311a_wrap.o: ../mockups/tca4311a_wrap/tca4311a_wrap.c + $(CC) $(FLAGS) -c $< -o $@ + +$(BUILD_DIR)/i2c_wrap.o: ../mockups/i2c_wrap/i2c_wrap.c + $(CC) $(FLAGS) -c $< -o $@ + +$(BUILD_DIR)/i2c_slave_wrap.o: ../mockups/i2c_slave_wrap/i2c_slave_wrap.c $(CC) $(FLAGS) -c $< -o $@ -$(BUILD_DIR)/gpio_wrap.o: ../mockups/gpio_wrap.c +$(BUILD_DIR)/uart_interrupt_wrap.o: ../mockups/uart_interrupt_wrap/uart_interrupt_wrap.c $(CC) $(FLAGS) -c $< -o $@ + .PHONY: clean clean: - rm $(BUILD_DIR)/$(TARGET_LEDS) $(BUILD_DIR)/*.o + rm $(BUILD_DIR)/$(TARGET_LEDS) $(BUILD_DIR)/$(TARGET_CURRENT_SENSOR) $(BUILD_DIR)/$(TARGET_TEMP_SENSOR) $(BUILD_DIR)/$(TARGET_VOLTAGE_SENSOR) $(BUILD_DIR)/$(TARGET_OBDH) $(BUILD_DIR)/$(TARGET_TTC) $(BUILD_DIR)/*.o diff --git a/firmware/tests/devices/current_sensor_test.c b/firmware/tests/devices/current_sensor_test.c new file mode 100644 index 0000000..bb89471 --- /dev/null +++ b/firmware/tests/devices/current_sensor_test.c @@ -0,0 +1,67 @@ +/* + * current_sensor_test.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief Unit test of the Current Sensor device + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/08/23 + * + * \defgroup current_sensor_test Current Sensor + * \ingroup tests + * \{ + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +static void current_sensor_init_test(void **state) { + +} + +static void current_sensor_raw_read_test(void **state) { + +} + +int main(void) { + const struct CMUnitTest current_sensor_tests[] = { + cmocka_unit_test(current_sensor_init_test), + cmocka_unit_test(current_sensor_raw_read_test), + }; + + return cmocka_run_group_tests(current_sensor_tests, NULL, NULL); +} + + +/** \} End of current_sensor_test group */ diff --git a/firmware/tests/devices/leds_test.c b/firmware/tests/devices/leds_test.c index 6db4d60..c25564c 100644 --- a/firmware/tests/devices/leds_test.c +++ b/firmware/tests/devices/leds_test.c @@ -44,7 +44,6 @@ #include #include -#include #define LED_SYSTEM_NUM 0 #define LED_FAULT_NUM 1 diff --git a/firmware/tests/devices/obdh_test.c b/firmware/tests/devices/obdh_test.c new file mode 100644 index 0000000..204d543 --- /dev/null +++ b/firmware/tests/devices/obdh_test.c @@ -0,0 +1,72 @@ +/* + * obdh_test.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief Unit test of the OBDH device. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/15 + * + * \defgroup obdh_unit_test OBDH + * \ingroup tests + * \{ + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +static void obdh_init_test(void** state) { + +} + +static void obdh_decocde_test(void **state) { + +} + +static void obdh_answer_test(void** state) { + +} + +int main(void) { + const struct CMUnitTest obdh_tests[] = { + cmocka_unit_test(obdh_init_test), + cmocka_unit_test(obdh_decocde_test), + cmocka_unit_test(obdh_answer_test), + + }; + + return cmocka_run_group_tests(obdh_tests, NULL, NULL); +} + +/** \} End of obdh_test group */ diff --git a/firmware/tests/devices/temp_sensor_test.c b/firmware/tests/devices/temp_sensor_test.c new file mode 100644 index 0000000..6332fdd --- /dev/null +++ b/firmware/tests/devices/temp_sensor_test.c @@ -0,0 +1,113 @@ +/* + * temp_sensor_test.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief Unit test of the Temp Sensor device. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/06 + * + * \defgroup leds_unit_test LEDs + * \ingroup tests + * \{ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static void temp_sensor_init_test(void **state) { + +} + +static void temp_sensor_suspend_test(void **state) { + +} + +static void temp_mcu_read_raw_test(void **state) { + +} + +static void temp_mcu_raw_to_c_test(void **state) { + +} + +static void temp_mcu_raw_to_k_test(void **state) { + +} + +static void temp_mcu_read_c_test(void **state) { + +} + +static void temp_mcu_read_k_test(void **state) { + +} + +static void temp_rtd_read_raw_test(void **state) { + +} + +static void temp_rtd_raw_to_c_test(void **state) { + +} + +static void temp_rtd_raw_to_k_test(void **state) { + +} + +static void temp_rtd_read_c_test(void **state) { + +} + +static void temp_rtd_read_k_test(void **state) { + +} + +int main(void) { + const struct CMUnitTest temp_sensor_tests[] = { + cmocka_unit_test(temp_sensor_init_test), + cmocka_unit_test(temp_sensor_suspend_test), + cmocka_unit_test(temp_mcu_read_raw_test), + cmocka_unit_test(temp_mcu_raw_to_c_test), + cmocka_unit_test(temp_mcu_raw_to_k_test), + cmocka_unit_test(temp_mcu_read_c_test), + cmocka_unit_test(temp_mcu_read_k_test), + cmocka_unit_test(temp_rtd_read_raw_test), + cmocka_unit_test(temp_rtd_raw_to_c_test), + cmocka_unit_test(temp_rtd_raw_to_k_test), + cmocka_unit_test(temp_rtd_read_c_test), + cmocka_unit_test(temp_rtd_read_k_test) + }; + + return cmocka_run_group_tests(temp_sensor_tests, NULL, NULL); +} diff --git a/firmware/tests/devices/ttc_test.c b/firmware/tests/devices/ttc_test.c new file mode 100644 index 0000000..e2127a0 --- /dev/null +++ b/firmware/tests/devices/ttc_test.c @@ -0,0 +1,69 @@ +/* + * ttc_test.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief Unit test of the TTC device. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/15 + * + * \defgroup ttc_unit_test TTC + * \ingroup tests + * \{ + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +static void ttc_init_test(void **state) { + +} + +static void ttc_decode_test(void **state) { + +} + +static void ttc_answer_test(void **state) { + +} + +int main(void) { + const struct CMUnitTest ttc_tests[] = { + cmocka_unit_test(ttc_init_test), + cmocka_unit_test(ttc_decode_test), + cmocka_unit_test(ttc_answer_test), + }; + + return cmocka_run_group_tests(ttc_tests, NULL, NULL); +} + +/** \} End of ttc_test group */ diff --git a/firmware/tests/devices/voltage_sensor_test.c b/firmware/tests/devices/voltage_sensor_test.c new file mode 100644 index 0000000..f5ded49 --- /dev/null +++ b/firmware/tests/devices/voltage_sensor_test.c @@ -0,0 +1,70 @@ +/* + * voltage_sensor_test.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief Unit test of the Voltage Sensor device. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/06 + * + * \defgroup voltage_sensor_unit_test Voltage Sensor + * \ingroup tests + * \{ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static void voltage_sensor_init_test(void **state) { + +} + +static void voltage_sensor_raw_to_mv_test(void **state) { + +} + +static void voltage_sensor_read_test(void **state) { + +} + +int main(void) { + const struct CMUnitTest voltage_sensor_tests[] = { + cmocka_unit_test(voltage_sensor_init_test), + cmocka_unit_test(voltage_sensor_raw_to_mv_test), + cmocka_unit_test(voltage_sensor_read_test) + }; + + return cmocka_run_group_tests(voltage_sensor_tests, NULL, NULL); +} + +/** \} End of voltage_sensor_unit_test group */ diff --git a/firmware/tests/mockups/adc_wrap/adc_wrap.c b/firmware/tests/mockups/adc_wrap/adc_wrap.c new file mode 100644 index 0000000..9002894 --- /dev/null +++ b/firmware/tests/mockups/adc_wrap/adc_wrap.c @@ -0,0 +1,85 @@ +/* + * adc_wrap.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief ADC driver wrap definition. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/08/23 + * + * \defgroup adc_wrap ADC Wrap + * \ingroup tests + * \{ + */ + +#include +#include +#include +#include +#include +#include + +#include "adc_wrap.h" + +int __wrap_adc_init(adc_port_t port, adc_config_t config) { + check_expected(port); + + return mock_type(int); +} + +int __wrap_adc_read(adc_port_t port, uint16_t *val) { + check_expected(port); + + uint16_t adc_val = mock_type(uint16_t); + + if (val != NULL) { + *val = adc_val; + } + + return mock_type(int); +} + +float __wrap_adc_temp_get_mref(void) { + return mock_type(float); +} + +float __wrap_adc_temp_get_nref(void) { + return mock_type(float); +} + +bool __wrap_adc_mutex_create(void) { + return true; +} + +bool __wrap_adc_mutex_take(void) { + return true; +} + +bool __wrap_adc_mutex_give(void) { + return true; +} + + +/** \} End of adc_wrap group */ diff --git a/firmware/tests/mockups/adc_wrap/adc_wrap.h b/firmware/tests/mockups/adc_wrap/adc_wrap.h new file mode 100644 index 0000000..8f48a89 --- /dev/null +++ b/firmware/tests/mockups/adc_wrap/adc_wrap.h @@ -0,0 +1,62 @@ +/* + * adc_wrap.h + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief ADC driver wrap definition. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/08/23 + * + * \defgroup adc_wrap ADC Wrap + * \ingroup tests + * \{ + */ + +#ifndef ADC_WRAP_H +#define ADC_WRAP_H + +#include + +#include + +int __wrap_adc_init(adc_port_t port, adc_config_t config); + +int __wrap_adc_read(adc_port_t port, uint16_t *val); + +void __wrap_adc_delay_ms(uint16_t ms); + +float __wrap_adc_temp_get_mref(void); + +float __wrap_adc_temp_get_nref(void); + +bool __wrap_adc_mutex_create(void); + +bool __wrap_adc_mutex_take(void); + +bool __wrap_adc_mutex_give(void); + +#endif /* ADC_WRAP_H_ */ + +/** \} End of adc_wrap group */ diff --git a/firmware/tests/mockups/ads1248_wrap/ads1248_wrap.c b/firmware/tests/mockups/ads1248_wrap/ads1248_wrap.c new file mode 100644 index 0000000..5d49391 --- /dev/null +++ b/firmware/tests/mockups/ads1248_wrap/ads1248_wrap.c @@ -0,0 +1,68 @@ +/* + * ads1248_wrap.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief ADS1248 driver wrap implementation. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/06 + * + * \defgroup ads1248_wrap ADS1248 Wrap + * \ingroup tests + * \{ + */ + + +#include "ads1248_wrap.h" + +int __wrap_ads1248_init(ads1248_config_t *config) { + return 0; +} + +int __wrap_ads1248_reset(ads1248_config_t *config, ads1248_reset_mode_t mode) { + return 0; +} + +int __wrap_ads1248_config_regs(ads1248_config_t *config) { + return 0; +} + +int __wrap_ads1248_read_regs(ads1248_config_t *config, uint8_t *rd) { + return 0; +} + +int __wrap_ads1248_read_data(ads1248_config_t *config, uint8_t *rd, uint8_t positive_channel) { + return 0; +} + +int __wrap_ads1248_write_cmd(ads1248_config_t *config, ads1248_cmd_t cmd, uint8_t *rd, uint8_t positive_channel) { + return 0; +} + +int __wrap_ads1248_set_powerdown_mode(ads1248_config_t *config, ads1248_power_down_t mode) { + return 0; +} + +/** \} End of ads1248_wrap group */ diff --git a/firmware/tests/mockups/ads1248_wrap/ads1248_wrap.h b/firmware/tests/mockups/ads1248_wrap/ads1248_wrap.h new file mode 100644 index 0000000..a739ce6 --- /dev/null +++ b/firmware/tests/mockups/ads1248_wrap/ads1248_wrap.h @@ -0,0 +1,58 @@ +/* + * ads1248_wrap.h + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief ADS1248 driver wrap definition. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/06 + * + * \defgroup ads1248_wrap ADS1248 Wrap + * \ingroup tests + * \{ + */ + +#ifndef ADS1248_WRAP_H +#define ADS1248_WRAP_H + +#include +#include + +int __wrap_ads1248_init(ads1248_config_t *config); + +int __wrap_ads1248_reset(ads1248_config_t *config, ads1248_reset_mode_t mode); + +int __wrap_ads1248_config_regs(ads1248_config_t *config); + +int __wrap_ads1248_read_regs(ads1248_config_t *config, uint8_t *rd); + +int __wrap_ads1248_read_data(ads1248_config_t *config, uint8_t *rd, uint8_t positive_channel); + +int __wrap_ads1248_write_cmd(ads1248_config_t *config, ads1248_cmd_t cmd, uint8_t *rd, uint8_t positive_channel); + +int __wrap_ads1248_set_powerdown_mode(ads1248_config_t *config, ads1248_power_down_t mode); + +#endif /* ADS1248_WRAP_H_ */ +/** \} End of ads1248_wrap group */ diff --git a/firmware/tests/mockups/gpio_wrap.c b/firmware/tests/mockups/gpio_wrap/gpio_wrap.c similarity index 100% rename from firmware/tests/mockups/gpio_wrap.c rename to firmware/tests/mockups/gpio_wrap/gpio_wrap.c diff --git a/firmware/tests/mockups/gpio_wrap.h b/firmware/tests/mockups/gpio_wrap/gpio_wrap.h similarity index 100% rename from firmware/tests/mockups/gpio_wrap.h rename to firmware/tests/mockups/gpio_wrap/gpio_wrap.h diff --git a/firmware/tests/mockups/i2c_slave_wrap/i2c_slave_wrap.c b/firmware/tests/mockups/i2c_slave_wrap/i2c_slave_wrap.c new file mode 100644 index 0000000..b4b0381 --- /dev/null +++ b/firmware/tests/mockups/i2c_slave_wrap/i2c_slave_wrap.c @@ -0,0 +1,63 @@ +/* + * i2c_slave_wrap.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief i2c_slave driver wrap implementation. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/28 + * + * \defgroup i2c_slave_wrap I2C SLAVE Wrap + * \ingroup tests + * \{ + */ + +#include +#include + +uint8_t i2c_rx_buffer[I2C_RX_BUFFER_MAX_SIZE]; +uint8_t i2c_received_data_size = 0; + +int __wrap_i2c_slave_init(i2c_slave_port_t port) { + return 0; +} + +int __wrap_i2c_slave_set_mode(i2c_slave_port_t port, i2c_mode_t mode) { + return 0; +} + +int __wrap_i2c_slave_enable(i2c_slave_port_t port) { + return 0; +} + +int __wrap_i2c_slave_disable(i2c_slave_port_t port) { + return 0; +} + +int __wrap_i2c_slave_write(i2c_slave_port_t port, uint8_t *data, uint16_t len) { + return 0; +} + +/** \} End of i2c_slave_wrap group */ diff --git a/firmware/tests/mockups/i2c_slave_wrap/i2c_slave_wrap.h b/firmware/tests/mockups/i2c_slave_wrap/i2c_slave_wrap.h new file mode 100644 index 0000000..bd211bc --- /dev/null +++ b/firmware/tests/mockups/i2c_slave_wrap/i2c_slave_wrap.h @@ -0,0 +1,57 @@ +/* + * i2c_slave_wrap.h + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief i2c_slave driver wrap definition. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/28 + * + * \defgroup i2c_slave_wrap I2C SLAVE Wrap + * \ingroup tests + * \{ + */ +#ifndef I2C_SLAVE_WRAP_H +#define I2C_SLAVE_WRAP_H + +#include +#include +#include + +extern uint8_t i2c_rx_buffer[I2C_RX_BUFFER_MAX_SIZE]; +extern uint8_t i2c_received_data_size; + +int __wrap_i2c_slave_init(i2c_slave_port_t port); + +int __wrap_i2c_slave_set_mode(i2c_slave_port_t port, i2c_mode_t mode); + +int __wrap_i2c_slave_enable(i2c_slave_port_t port); + +int __wrap_i2c_slave_disable(i2c_slave_port_t port); + +int __wrap_i2c_slave_write(i2c_slave_port_t port, uint8_t *data, uint16_t len); + +#endif /* I2C_SLAVE_WRAP_H */ +/** \} End of i2c_slave_wrap group */ diff --git a/firmware/tests/mockups/i2c_wrap/i2c_wrap.c b/firmware/tests/mockups/i2c_wrap/i2c_wrap.c new file mode 100644 index 0000000..50a3c0d --- /dev/null +++ b/firmware/tests/mockups/i2c_wrap/i2c_wrap.c @@ -0,0 +1,51 @@ +/* + * i2c_wrap.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief i2c driver wrap implementation. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/28 + * + * \defgroup i2c_wrap I2C Wrap + * \ingroup tests + * \{ + */ + +#include "i2c_wrap.h" + +int __wrap_i2c_master_init(i2c_port_t port, i2c_config_t config) { + return 0; +} + +int __wrap_i2c_write(i2c_port_t port, i2c_slave_adr_t adr, uint8_t *data, uint16_t len) { + return 0; +} + +int __wrap_i2c_read(i2c_port_t port, i2c_slave_adr_t adr, uint8_t *data, uint16_t len) { + return 0; +} + +/** \} End of i2c_wrap group */ diff --git a/firmware/tests/mockups/i2c_wrap/i2c_wrap.h b/firmware/tests/mockups/i2c_wrap/i2c_wrap.h new file mode 100644 index 0000000..053924b --- /dev/null +++ b/firmware/tests/mockups/i2c_wrap/i2c_wrap.h @@ -0,0 +1,49 @@ +/* + * i2c_wrap.h + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief i2c driver wrap definition. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/28 + * + * \defgroup i2c_wrap I2C Wrap + * \ingroup tests + * \{ + */ + +#ifndef I2C_WRAP_H +#define I2C_WRAP_H + +#include + +int __wrap_i2c_master_init(i2c_port_t port, i2c_config_t config); + +int __wrap_i2c_write(i2c_port_t port, i2c_slave_adr_t adr, uint8_t *data, uint16_t len); + +int __wrap_i2c_read(i2c_port_t port, i2c_slave_adr_t adr, uint8_t *data, uint16_t len); + +#endif /* I2C_WRAP_H */ +/** \} End of i2c_wrap group */ diff --git a/firmware/tests/mockups/max9934_wrap/max9934_wrap.c b/firmware/tests/mockups/max9934_wrap/max9934_wrap.c new file mode 100644 index 0000000..ea197a3 --- /dev/null +++ b/firmware/tests/mockups/max9934_wrap/max9934_wrap.c @@ -0,0 +1,52 @@ +/* + * max9934_wrap.h + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief MAX9934 driver wrap implementation. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/08/24 + * + * \defgroup max9934_wrap MAX9934 Wrap + * \ingroup tests + * \{ + */ + +#include +#include +#include +#include +#include +#include + +#include "max9934_wrap.h" + +int __wrap_max9934_init(max9934_config_t config) { + return 0; +} + +int __wrap_max9934_read(max9934_config_t config, uint16_t *raw_val) { + return 0; +} diff --git a/firmware/tests/mockups/max9934_wrap/max9934_wrap.h b/firmware/tests/mockups/max9934_wrap/max9934_wrap.h new file mode 100644 index 0000000..f9c7b83 --- /dev/null +++ b/firmware/tests/mockups/max9934_wrap/max9934_wrap.h @@ -0,0 +1,49 @@ +/* + * max9934_wrap.h + * + * Copyright (C) 2020, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief MAX9934 driver wrap definition. + * + * \authors Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/08/24 + * + * \defgroup max9934_wrap MAX9934 Wrap + * \ingroup tests + * \{ + */ + +#ifndef MAX9934_WRAP_H +#define MAX9934_WRAP_H + +#include + +int __wrap_max9934_init(max9934_config_t config); + +int __wrap_max9934_read(max9934_config_t config, uint16_t *raw_val); + + +#endif /* MAX9934_WRAP_H_ */ + +/** \} End of max9934_wrap group */ diff --git a/firmware/tests/mockups/sys_log_wrap.c b/firmware/tests/mockups/sys_log_wrap/sys_log_wrap.c similarity index 100% rename from firmware/tests/mockups/sys_log_wrap.c rename to firmware/tests/mockups/sys_log_wrap/sys_log_wrap.c diff --git a/firmware/tests/mockups/sys_log_wrap.h b/firmware/tests/mockups/sys_log_wrap/sys_log_wrap.h similarity index 100% rename from firmware/tests/mockups/sys_log_wrap.h rename to firmware/tests/mockups/sys_log_wrap/sys_log_wrap.h diff --git a/firmware/tests/mockups/tca4311a_wrap/tca4311a_wrap.c b/firmware/tests/mockups/tca4311a_wrap/tca4311a_wrap.c new file mode 100644 index 0000000..a7e2791 --- /dev/null +++ b/firmware/tests/mockups/tca4311a_wrap/tca4311a_wrap.c @@ -0,0 +1,59 @@ +/* + * tca4311a_wrap.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief tca4311a_wrap driver wrap implementation. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/08/23 + * + * \defgroup tca4311a_wrap tca4311a_wrap Wrap + * \ingroup tests + * \{ + */ + + +#include "tca4311a_wrap.h" +#include +#include + +int __wrap_tca4311a_init(tca4311a_config_t config, bool en) { + return 0; +} + +int __wrap_tca4311a_enable(tca4311a_config_t config) { + return 0; +} + +int __wrap_tca4311a_disable(tca4311a_config_t config) { + return 0; +} + +int __tca4311a_is_ready(tca4311a_config_t config) { + return 0; +} + + +/** \} End of tca4311a_wrap group */ diff --git a/firmware/tests/mockups/tca4311a_wrap/tca4311a_wrap.h b/firmware/tests/mockups/tca4311a_wrap/tca4311a_wrap.h new file mode 100644 index 0000000..19348b3 --- /dev/null +++ b/firmware/tests/mockups/tca4311a_wrap/tca4311a_wrap.h @@ -0,0 +1,57 @@ +/* + * tca4311a_wrap.h + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief tca4311a_wrap driver wrap definition. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/08/23 + * + * \defgroup tca4311a_wrap tca4311a_wrap Wrap + * \ingroup tests + * \{ + */ + +#ifndef TCA4311A_WRAP_H +#define TCA4311A_WRAP_H + +#include +#include +#include + +#include +#include + +int __wrap_tca4311a_init(tca4311a_config_t config, bool en); + +int __wrap_tca4311a_enable(tca4311a_config_t config); + +int __wrap_tca4311a_disable(tca4311a_config_t config); + +int __wrap_tca4311a_is_ready(tca4311a_config_t config); + +#endif /* TCA4311A_WRAP_H */ + +/** \} End of tca4311a_wrap group */ diff --git a/firmware/tests/mockups/uart_interrupt_wrap/uart_interrupt_wrap.c b/firmware/tests/mockups/uart_interrupt_wrap/uart_interrupt_wrap.c new file mode 100644 index 0000000..157bf9b --- /dev/null +++ b/firmware/tests/mockups/uart_interrupt_wrap/uart_interrupt_wrap.c @@ -0,0 +1,59 @@ +/* + * uart_interrupt_wrap.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief UART Interrupt wrap implementation. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/15 + * + * \defgroup uart_interrupt_wrap UART INTERRUPT Wrap + * \ingroup tests + * \{ + */ + +#include "uart_interrupt_wrap.h" + +uint8_t uart_rx_buffer[UART_RX_BUFFER_MAX_SIZE]; +uint8_t uart_received_data_size = 0; +uint8_t uart_buffer_index = 0; + +int __wrap_uart_interrupt_init(uart_interrupt_port_t port, uart_interrupt_config_t config) { + return 0; +} +int __wrap_uart_interrupt_enable(uart_interrupt_port_t port) { + return 0; +} + +int __wrap_uart_interrupt_disable(uart_interrupt_port_t port) { + return 0; +} + +int __wrap_uart_interrupt_write(uart_interrupt_port_t port, uint8_t *data, uint16_t len) { + return 0; +} + + +/** \} End of uart_interrupt_wrap group */ diff --git a/firmware/tests/mockups/uart_interrupt_wrap/uart_interrupt_wrap.h b/firmware/tests/mockups/uart_interrupt_wrap/uart_interrupt_wrap.h new file mode 100644 index 0000000..307c6d2 --- /dev/null +++ b/firmware/tests/mockups/uart_interrupt_wrap/uart_interrupt_wrap.h @@ -0,0 +1,57 @@ +/* + * uart_interrupt_wrap.h + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief UART Interrupt wrap definition. + * + * \author Lucas Zacchi de Medeiros + * + * \version 0.1.0 + * + * \date 2021/09/15 + * + * \defgroup uart_interrupt_wrap UART INTERRUPT Wrap + * \ingroup tests + * \{ + */ + +#ifndef UART_INTERRUPT_WRAP_H +#define UART_INTERRUPT_WRAP_H + +#include + +#include + +extern uint8_t uart_rx_buffer[UART_RX_BUFFER_MAX_SIZE]; +extern uint8_t uart_received_data_size; + +int __wrap_uart_interrupt_init(uart_interrupt_port_t port, uart_interrupt_config_t config); + +int __wrap_uart_interrupt_enable(uart_interrupt_port_t port); + +int __wrap_uart_interrupt_disable(uart_interrupt_port_t port); + +int __wrap_uart_interrupt_write(uart_interrupt_port_t port, uint8_t *data, uint16_t len); + +#endif /* UART_INTERRUPT_WRAP_H */ + +/** \} End of uart_interrupt_wrap group */