diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3aded35 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Unity Test Explorer Debug", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/${command:unityExplorer.debugTestExecutable}", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "C:/Apps/mingw64/bin/gdb.exe", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..49a17dd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,14 @@ +{ + "unityExplorer.testSourceFileRegex": "\\w+_test.c", + "unityExplorer.testCaseRegex": "void\\s+(test_.*)\\s*\\(.*\\)", + "unityExplorer.testExecutableRegex": "build/exe/$1.exe", + "unityExplorer.testSourceFolder": "test", + "unityExplorer.testBuildApplication": "ninja", + "unityExplorer.testBuildCwdPath": "build", + // "unityExplorer.unitUnderTestFolder": "cmd_parser", + "unityExplorer.unitUnderTestFileRegex": "\\w+\\.[ch]", + "unityExplorer.prettyTestCaseRegex": "test_(\\w+)", + "unityExplorer.prettyTestFileRegex": "(\\w+)_test\\.c", + "unityExplorer.debugConfiguration": "Unity Test Explorer Debug", + +} \ No newline at end of file diff --git a/cmd_parser/cmd_parser.c b/cmd_parser/cmd_parser.c index e69de29..11a5472 100644 --- a/cmd_parser/cmd_parser.c +++ b/cmd_parser/cmd_parser.c @@ -0,0 +1,6 @@ +#include "cmd_parser.h" + +void cmd_parse(char* msg) +{ + +} \ No newline at end of file diff --git a/cmd_parser/cmd_parser.h b/cmd_parser/cmd_parser.h index 3f59c93..8e454e2 100644 --- a/cmd_parser/cmd_parser.h +++ b/cmd_parser/cmd_parser.h @@ -1,2 +1,6 @@ #pragma once +typedef void(*help_filter)(char key, const char *text); +// void parser (int key, char *arg, struct argp_state *state); + +void cmd_parse(char* msg); \ No newline at end of file diff --git a/test/cmd_parser/CMakeLists.txt b/test/cmd_parser/CMakeLists.txt index a479075..3a9714e 100644 --- a/test/cmd_parser/CMakeLists.txt +++ b/test/cmd_parser/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10) -set(TEST_NAME cmd_parser) +set(TEST_NAME cmd_parser_test) set(INCLUDE_DIRS ../../cmd_parser diff --git a/test/cmd_parser/cmd_parser_test.c b/test/cmd_parser/cmd_parser_test.c index 3ad6b68..956e7bb 100644 --- a/test/cmd_parser/cmd_parser_test.c +++ b/test/cmd_parser/cmd_parser_test.c @@ -12,9 +12,10 @@ void tearDown(void) { } -void test_one(void) + +void test_CommandDetetection(void) { - TEST_FAIL(); + TEST_ASSERT(1==1); } @@ -22,7 +23,7 @@ void test_one(void) int main(void) { UNITY_BEGIN(); - RUN_TEST(test_one); + RUN_TEST(test_CommandDetetection); return UNITY_END(); } \ No newline at end of file diff --git a/test/cmd_parser/helpers/inc/main.h b/test/cmd_parser/helpers/inc/main.h new file mode 100644 index 0000000..20bf192 --- /dev/null +++ b/test/cmd_parser/helpers/inc/main.h @@ -0,0 +1,3 @@ +#pragma once + +#include diff --git a/test/cmd_parser/helpers/inc/pwm_cmd.h b/test/cmd_parser/helpers/inc/pwm_cmd.h new file mode 100644 index 0000000..5181633 --- /dev/null +++ b/test/cmd_parser/helpers/inc/pwm_cmd.h @@ -0,0 +1,42 @@ +#include "main.h" +#include "cmd_parser.h" + +/* +Usage: led set|get [-p PNUM | --power=PNUM] [-w CHOICES | --which=CHOICES] [-m COICES | --mode=CHOICES] + -p, --power set or get power 0-100 + -w, --which set or get specific leds [Atop, Abot, Btop, Bbot, Ctop, Cbot, all] + -m, --mode set or get mode of operation [allways_on, scan] +*/ + +typedef enum +{ + get, + set, +} led_action_t; + +typedef enum +{ + Atop = (1 << 0), + Abot = (1 << 1), + Btop = (1 << 2), + Bbot = (1 << 3), + Ctop = (1 << 4), + Cbot = (1 << 5), + all = 0xFF, +} led_leds_t; + +typedef enum +{ + allways_on, + scan, +} led_mode_t; + +typedef struct +{ + led_action_t action; + uint8_t power; + led_leds_t leds; + led_mode_t mode; +} led_option_t; + +void led_parse_callback(char key, const char *text); \ No newline at end of file