Files
uC_libs/test/cmd_parser/helpers/src/led_cmd.c
2022-12-03 20:00:11 +01:00

62 lines
1.4 KiB
C

#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,
};