diff --git a/.vscode/cmake-variants.json b/.vscode/cmake-variants.json index af1e878..750797d 100644 --- a/.vscode/cmake-variants.json +++ b/.vscode/cmake-variants.json @@ -27,8 +27,17 @@ "SUBSYSTEM": "gamma" }, "short": "spl/gamma" + }, + "spl/disco": { + "buildType": "spl_disco", + "long": "select to build variant 'spl/disco'", + "settings": { + "FLAVOR": "spl", + "SUBSYSTEM": "disco" + }, + "short": "spl/disco" } }, - "default": "alpha" + "default": "disco" } } diff --git a/src/console_interface/CMakeLists.txt b/src/console_interface/CMakeLists.txt new file mode 100644 index 0000000..7fddede --- /dev/null +++ b/src/console_interface/CMakeLists.txt @@ -0,0 +1,2 @@ +spl_add_source(src/console_interface.c) +spl_create_component() diff --git a/src/console_interface/src/console_interface.c b/src/console_interface/src/console_interface.c new file mode 100644 index 0000000..c35ae42 --- /dev/null +++ b/src/console_interface/src/console_interface.c @@ -0,0 +1,5 @@ +#include "console_interface.h" + +void consoleInterface(void) { + +} diff --git a/src/console_interface/src/console_interface.h b/src/console_interface/src/console_interface.h new file mode 100644 index 0000000..cfb7e9b --- /dev/null +++ b/src/console_interface/src/console_interface.h @@ -0,0 +1,8 @@ +#ifndef __console_interface_h__ +#define __console_interface_h__ + +#include "rte.h" + +void consoleInterface(void); + +#endif // __console_interface_h__ diff --git a/src/keyboard_interface/CMakeLists.txt b/src/keyboard_interface/CMakeLists.txt new file mode 100644 index 0000000..7b1e309 --- /dev/null +++ b/src/keyboard_interface/CMakeLists.txt @@ -0,0 +1,2 @@ +spl_add_source(src/keyboard_interface.c) +spl_create_component() diff --git a/src/keyboard_interface/src/keyboard_interface.c b/src/keyboard_interface/src/keyboard_interface.c new file mode 100644 index 0000000..4b844d1 --- /dev/null +++ b/src/keyboard_interface/src/keyboard_interface.c @@ -0,0 +1,14 @@ +#include "keyboard_interface.h" +#include + +boolean isKeyPressed(int key) { + if (GetAsyncKeyState(key)) { + return TRUE; + } else { + return FALSE; + } +} + +void keyboardInterface(){ + +} \ No newline at end of file diff --git a/src/keyboard_interface/src/keyboard_interface.h b/src/keyboard_interface/src/keyboard_interface.h new file mode 100644 index 0000000..0a161cd --- /dev/null +++ b/src/keyboard_interface/src/keyboard_interface.h @@ -0,0 +1,8 @@ +#ifndef __keyboard_interface_h__ +#define __keyboard_interface_h__ + +#include "rte.h" + +void keyboardInterface(); + +#endif // __keyboard_interface_h__ diff --git a/src/light_controller/CMakeLists.txt b/src/light_controller/CMakeLists.txt new file mode 100644 index 0000000..ae74eca --- /dev/null +++ b/src/light_controller/CMakeLists.txt @@ -0,0 +1,2 @@ +spl_add_source(src/light_controller.c) +spl_create_component() diff --git a/src/light_controller/src/light_controller.c b/src/light_controller/src/light_controller.c new file mode 100644 index 0000000..8a58adc --- /dev/null +++ b/src/light_controller/src/light_controller.c @@ -0,0 +1,6 @@ +#include "light_controller.h" +#include "Rte.h" + +void lightController(void) { + +} diff --git a/src/light_controller/src/light_controller.h b/src/light_controller/src/light_controller.h new file mode 100644 index 0000000..a2f679b --- /dev/null +++ b/src/light_controller/src/light_controller.h @@ -0,0 +1,6 @@ +#ifndef __light_controller_h__ +#define __light_controller_h__ + +void lightController(void); + +#endif // __light_controller_h__ diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 8a47c92..a4885aa 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -1,2 +1,2 @@ -include(parts.cmake) +spl_add_source(src/main.c) spl_create_component() diff --git a/src/main/parts.cmake b/src/main/parts.cmake deleted file mode 100644 index 4790d4e..0000000 --- a/src/main/parts.cmake +++ /dev/null @@ -1 +0,0 @@ -spl_add_source(src/main.c) \ No newline at end of file diff --git a/src/main/src/main.c b/src/main/src/main.c index 96a696a..26f5b06 100644 --- a/src/main/src/main.c +++ b/src/main/src/main.c @@ -1,14 +1,12 @@ #include "autoconf.h" - -#if CONFIG_DUMMY_INTERFACE_DEFINED -#include "component.h" -extern int dummyInterface(void); -#endif +#include "spled.h" int main(void) { -#if (CONFIG_DUMMY_INTERFACE_DEFINED) - return dummyInterface(); -#else + + while (1) + { + spled(); + } + return 0; -#endif } diff --git a/src/power_signal_processing/CMakeLists.txt b/src/power_signal_processing/CMakeLists.txt new file mode 100644 index 0000000..b7a44a6 --- /dev/null +++ b/src/power_signal_processing/CMakeLists.txt @@ -0,0 +1,2 @@ +spl_add_source(src/power_signal_processing.c) +spl_create_component() diff --git a/src/power_signal_processing/src/power_signal_processing.c b/src/power_signal_processing/src/power_signal_processing.c new file mode 100644 index 0000000..d590900 --- /dev/null +++ b/src/power_signal_processing/src/power_signal_processing.c @@ -0,0 +1,7 @@ +#include "power_signal_processing.h" +#include "Rte.h" + +// Function to check if "P" key was pressed and toggle power accordingly +void powerSignalProcessing(void) { + +} diff --git a/src/power_signal_processing/src/power_signal_processing.h b/src/power_signal_processing/src/power_signal_processing.h new file mode 100644 index 0000000..b2fef0b --- /dev/null +++ b/src/power_signal_processing/src/power_signal_processing.h @@ -0,0 +1,6 @@ +#ifndef __power_signal_processing_h__ +#define __power_signal_processing_h__ + +void powerSignalProcessing(void); + +#endif // __power_signal_processing_h__ diff --git a/src/rte/CMakeLists.txt b/src/rte/CMakeLists.txt new file mode 100644 index 0000000..4f1e1ae --- /dev/null +++ b/src/rte/CMakeLists.txt @@ -0,0 +1,2 @@ +spl_add_source(src/rte.c) +spl_create_component() diff --git a/src/rte/src/rte.c b/src/rte/src/rte.c new file mode 100644 index 0000000..abc17f3 --- /dev/null +++ b/src/rte/src/rte.c @@ -0,0 +1,30 @@ +#include "rte.h" + +// Internal variable to hold the power state +static PowerState currentPowerState = POWER_STATE_OFF; +static boolean powerKeyPressed = FALSE; +static int lightValue = 0; + +void RteSetPowerState(PowerState state) { + currentPowerState = state; +} + +PowerState RteGetPowerState(void) { + return currentPowerState; +} + +void RteSetPowerKeyPressed(boolean value) { + powerKeyPressed = value; +} + +boolean RteGetPowerKeyPressed() { + return powerKeyPressed; +} + +void RteSetLightValue(int value) { + lightValue = value; +} + +int RteGetLightValue(void) { + return lightValue; +} \ No newline at end of file diff --git a/src/rte/src/rte.h b/src/rte/src/rte.h new file mode 100644 index 0000000..493fd57 --- /dev/null +++ b/src/rte/src/rte.h @@ -0,0 +1,24 @@ +#ifndef __rte_h__ +#define __rte_h__ + +// Define type for boolean +typedef unsigned char boolean; +#define TRUE 1 +#define FALSE 0 + +// Define the PowerState type +typedef enum { + POWER_STATE_OFF = 0, + POWER_STATE_ON = 1 +} PowerState; + +void RteSetPowerState(PowerState state); +PowerState RteGetPowerState(void); + +boolean RteGetPowerKeyPressed(); +void RteSetPowerKeyPressed(boolean value); + +void RteSetLightValue(int value); +int RteGetLightValue(void); + +#endif // __rte_h__ diff --git a/src/spled/CMakeLists.txt b/src/spled/CMakeLists.txt new file mode 100644 index 0000000..eab34c7 --- /dev/null +++ b/src/spled/CMakeLists.txt @@ -0,0 +1,2 @@ +spl_add_source(src/spled.c) +spl_create_component() diff --git a/src/spled/src/spled.c b/src/spled/src/spled.c new file mode 100644 index 0000000..cec6b6b --- /dev/null +++ b/src/spled/src/spled.c @@ -0,0 +1,15 @@ +#include + +#include "spled.h" + +#include "keyboard_interface.h" +#include "power_signal_processing.h" +#include "light_controller.h" +#include "console_interface.h" + +void spled(void) { + keyboardInterface(); + powerSignalProcessing(); + lightController(); + consoleInterface(); +} diff --git a/src/spled/src/spled.h b/src/spled/src/spled.h new file mode 100644 index 0000000..3bf7083 --- /dev/null +++ b/src/spled/src/spled.h @@ -0,0 +1,6 @@ +#ifndef __spled_h__ +#define __spled_h__ + +void spled(void); + +#endif // __spled_h__ \ No newline at end of file diff --git a/variants/spl/disco/config.cmake b/variants/spl/disco/config.cmake new file mode 100644 index 0000000..a987ff5 --- /dev/null +++ b/variants/spl/disco/config.cmake @@ -0,0 +1 @@ +set(CMAKE_TOOLCHAIN_FILE tools/toolchains/gcc/toolchain.cmake CACHE PATH "toolchain file") diff --git a/variants/spl/disco/config.txt b/variants/spl/disco/config.txt new file mode 100644 index 0000000..3e23517 --- /dev/null +++ b/variants/spl/disco/config.txt @@ -0,0 +1,28 @@ + +# +# SPL Extensions +# + +# +# ZIP extension +# +CONFIG_ZIP_FEATURE=n +CONFIG_ZIP_TOOL_VERSION="1.0.2" +# end of ZIP extension +# end of SPL Extensions + +# +# Linking +# +CONFIG_LINKER_OUTPUT_FILE="my_main.exe" +CONFIG_LINKER_BYPRODUCTS_EXTENSIONS="map" +# end of Linking + +# +# Feature Model +# +CONFIG_USE_COMPONENT_A_INTERFACE=y +# CONFIG_USE_COMPONENT_B_INTERFACE is not set +CONFIG_DUMMY_INTERFACE_DEFINED=y +CONFIG_PART_NUMBER="PN0013" +# end of Feature Model diff --git a/variants/spl/disco/parts.cmake b/variants/spl/disco/parts.cmake new file mode 100644 index 0000000..c8fdc89 --- /dev/null +++ b/variants/spl/disco/parts.cmake @@ -0,0 +1,7 @@ +spl_add_component(src/main) +spl_add_component(src/rte) +spl_add_component(src/spled) +spl_add_component(src/power_signal_processing) +spl_add_component(src/light_controller) +spl_add_component(src/keyboard_interface) +spl_add_component(src/console_interface)