first working version
This commit is contained in:
62
test/cmd_parser/helpers/src/led_cmd.c
Normal file
62
test/cmd_parser/helpers/src/led_cmd.c
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "led_cmd.h"
|
||||
|
||||
enum {set, get};
|
||||
|
||||
option_t set_options[] = {
|
||||
{
|
||||
.opt_id = 'p',
|
||||
.name = "power",
|
||||
.flags = SINGLE_VALE,
|
||||
.description = "sets the power of the light",
|
||||
},
|
||||
|
||||
{
|
||||
.opt_id = 'l',
|
||||
.name = "led",
|
||||
.flags = MULTI_VALUE,
|
||||
.description = "diode selection. OPTIONS = [Atop, Abot, Btop, Bbot, Ctop, Cbot, all]",
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
option_t get_options[] = {
|
||||
{
|
||||
.opt_id = 'p',
|
||||
.name = "power",
|
||||
.flags = NO_VALUE,
|
||||
.description = "gets the power of the light",
|
||||
},
|
||||
|
||||
{
|
||||
.opt_id = 'l',
|
||||
.name = "led",
|
||||
.flags = MULTI_VALUE,
|
||||
.description = "diode selection. OPTIONS = [Atop, Abot, Btop, Bbot, Ctop, Cbot, all]",
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
argument_t arguments[] = {
|
||||
{
|
||||
.name = "set",
|
||||
.arg_id = set,
|
||||
.options = set_options,
|
||||
.opt_num = sizeof(set_options) / (sizeof(set_options[0])),
|
||||
.description = "allows to set operating parameters",
|
||||
},
|
||||
{
|
||||
.name = "get",
|
||||
.arg_id = get,
|
||||
.options = get_options,
|
||||
.opt_num = sizeof(get_options) / (sizeof(get_options[0])),
|
||||
.description = "allows to get operating parameters",
|
||||
},
|
||||
};
|
||||
|
||||
cmd_parser_t led_cmd = {
|
||||
.name = "led",
|
||||
.arguments = arguments,
|
||||
.arg_num = sizeof(arguments) / sizeof(arguments[0]),
|
||||
.description = "allows to controll and check leds",
|
||||
.cmd_parser = parse_callback,
|
||||
};
|
||||
Reference in New Issue
Block a user