From a77e54435882fbed7178d37aa253fa2bfc05302f Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Wed, 21 Aug 2024 19:59:14 -0700 Subject: [PATCH] Added LED Controller module. --- src/CMakeLists.txt | 1 + src/LedController/CMakeLists.txt | 7 ++++ src/LedController/LedController.c | 11 +++++++ src/LedController/LedController.h | 23 +++++++++++++ tests/CMakeLists.txt | 2 ++ tests/LedController/CMakeLists.txt | 10 ++++++ tests/LedController/test_LedController.cpp | 38 ++++++++++++++++++++++ 7 files changed, 92 insertions(+) create mode 100644 src/LedController/CMakeLists.txt create mode 100644 src/LedController/LedController.c create mode 100644 src/LedController/LedController.h create mode 100644 tests/LedController/CMakeLists.txt create mode 100644 tests/LedController/test_LedController.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 476954c..6d3ba2f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,3 +52,4 @@ endif() add_subdirectory(RegEdit) add_subdirectory(usart) add_subdirectory(timer) +add_subdirectory(LedController) diff --git a/src/LedController/CMakeLists.txt b/src/LedController/CMakeLists.txt new file mode 100644 index 0000000..9f20f68 --- /dev/null +++ b/src/LedController/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(LedController STATIC + LedController.c +) + +target_include_directories(LedController PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) diff --git a/src/LedController/LedController.c b/src/LedController/LedController.c new file mode 100644 index 0000000..fc917db --- /dev/null +++ b/src/LedController/LedController.c @@ -0,0 +1,11 @@ +/* + * Author: Jake G + * Date: 2024 + * filename: LedController.c + * description: Abstract LED interface and control. + */ + +#include "LedController.h" + + + diff --git a/src/LedController/LedController.h b/src/LedController/LedController.h new file mode 100644 index 0000000..8100953 --- /dev/null +++ b/src/LedController/LedController.h @@ -0,0 +1,23 @@ +/** + * @brief Led Controller module + * @details This file outputs a byte of data to the pins for led indication. + * @author Jake G + * @date 2024-08-21 + * @copyright None + * @file LEDCONTROLLER.h + */ + +#ifndef LEDCONTROLLER +#define LEDCONTROLLER + + +/** + * A function that adds two to a number + * @param a The first argument + */ +int add_two(int a); + + + + +#endif //LEDCONTROLLER diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 90d9c38..d440dad 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,7 @@ project(Tests) # TEST_DIRS +add_subdirectory(LedController) add_subdirectory(timer) #add_subdirectory(usart) add_subdirectory(MockRegEdit) @@ -20,6 +21,7 @@ target_link_libraries(AllTests ${CPPUTEST_LIBRARIES}/libCppUTest.a ${CPPUTEST_LIBRARIES}/libCppUTestExt.a # TEST_LINKS + test_LedController test_timer test_RegEdit simple_test diff --git a/tests/LedController/CMakeLists.txt b/tests/LedController/CMakeLists.txt new file mode 100644 index 0000000..d5ef018 --- /dev/null +++ b/tests/LedController/CMakeLists.txt @@ -0,0 +1,10 @@ +# TEST_RUNNER +add_library(test_LedController + test_LedController.cpp +) + +target_link_libraries(test_LedController + ${CPPUTEST_LIBRARIES}/libCppUTest.a + ${CPPUTEST_LIBRARIES}/libCppUTestExt.a + LedController +) diff --git a/tests/LedController/test_LedController.cpp b/tests/LedController/test_LedController.cpp new file mode 100644 index 0000000..4134c30 --- /dev/null +++ b/tests/LedController/test_LedController.cpp @@ -0,0 +1,38 @@ +/* + * Author: username + * Date: todays_date + * filename: test_LedController.c + * description: module_purpose + */ + +#include "CppUTest/CommandLineTestRunner.h" + +extern "C" +{ +#include "LedController.h" +} + +TEST_GROUP(test_LedController) +{ + void setup() + { + + } + void teardown() + { + + } +}; + +TEST(test_LedController, FirstTest) +{ + FAIL("Fail me!"); +} + +TEST(test_LedController, SecondTest) +{ + STRCMP_EQUAL("hello", "world"); + LONGS_EQUAL(1, 2); + CHECK(false); +} +