X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=commands.c;h=b58594ad58aae930a449ba07768159207f4afaeb;hp=c9d415f64eb48af03e3cbdc3339d1c155fefc201;hb=9a43add2f0ed382ce1f180bba65fdc077d03b6fb;hpb=bf003cd191abeafb1c31a7a24aa573b7a20e527e diff --git a/commands.c b/commands.c index c9d415f..b58594a 100644 --- a/commands.c +++ b/commands.c @@ -51,6 +51,7 @@ #include "rc_proto.h" #include "main.h" #include "cmdline.h" +#include "beep.h" /* commands_gen.c */ extern const parse_inst_t PROGMEM cmd_reset; @@ -1299,6 +1300,45 @@ const parse_inst_t PROGMEM cmd_baudrate = { }, }; + +/**********************************************************/ + +/* this structure is filled when cmd_beep is parsed successfully */ +struct cmd_beep_result { + fixed_string_t beep; +}; + +/* function called when cmd_beep is parsed successfully */ +static void cmd_beep_parsed(void *parsed_result, void *data) +{ + (void)parsed_result; + (void)data; + + beep(0, 3, 3); + beep(1, 3, 3); + beep(2, 3, 3); + beep(0, 1, 1); + beep(1, 1, 1); + beep(2, 1, 1); +} + +const char PROGMEM str_beep[] = "beep"; +const parse_token_string_t PROGMEM cmd_beep_beep = + TOKEN_STRING_INITIALIZER(struct cmd_beep_result, beep, + str_beep); + +const char PROGMEM help_beep[] = "Send a beep"; + +const parse_inst_t PROGMEM cmd_beep = { + .f = cmd_beep_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_beep, + .tokens = { /* token list, NULL terminated */ + (PGM_P)&cmd_beep_beep, + NULL, + }, +}; + /**********************************************************/ /* this structure is filled when cmd_servo is parsed successfully */ @@ -1546,6 +1586,7 @@ const parse_ctx_t PROGMEM main_ctx[] = { &cmd_dump, &cmd_debug, &cmd_baudrate, + &cmd_beep, &cmd_servo_set, &cmd_servo_bypassppm, &cmd_servo_show,