/*
* Copyright Droids Corporation (2009)
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
*
* Revision : $Id: commands_ballboard.c,v 1.2 2009-04-24 19:30:42 zer0 Exp $
*
- * Olivier MATZ <zer0@droids-corp.org>
+ * Olivier MATZ <zer0@droids-corp.org>
*/
#include <stdio.h>
u08 bit=0;
struct cmd_event_result * res = parsed_result;
-
+
if (!strcmp_P(res->arg1, PSTR("all"))) {
- bit = DO_ENCODERS | DO_CS | DO_BD | DO_POWER;
+ bit = 0xFF;
if (!strcmp_P(res->arg2, PSTR("on")))
ballboard.flags |= bit;
else if (!strcmp_P(res->arg2, PSTR("off")))
ballboard.flags &= bit;
else { /* show */
- printf_P(PSTR("encoders is %s\r\n"),
+ printf_P(PSTR("encoders is %s\r\n"),
(DO_ENCODERS & ballboard.flags) ? "on":"off");
- printf_P(PSTR("cs is %s\r\n"),
+ printf_P(PSTR("cs is %s\r\n"),
(DO_CS & ballboard.flags) ? "on":"off");
- printf_P(PSTR("bd is %s\r\n"),
+ printf_P(PSTR("bd is %s\r\n"),
(DO_BD & ballboard.flags) ? "on":"off");
- printf_P(PSTR("power is %s\r\n"),
+ printf_P(PSTR("power is %s\r\n"),
(DO_POWER & ballboard.flags) ? "on":"off");
+ printf_P(PSTR("errblock is %s\r\n"),
+ (DO_ERRBLOCKING & ballboard.flags) ? "on":"off");
}
return;
}
bit = DO_BD;
else if (!strcmp_P(res->arg1, PSTR("power")))
bit = DO_POWER;
+ else if (!strcmp_P(res->arg1, PSTR("errblock")))
+ bit = DO_ERRBLOCKING;
if (!strcmp_P(res->arg2, PSTR("on")))
}
ballboard.flags &= (~bit);
}
- printf_P(PSTR("%s is %s\r\n"), res->arg1,
+ printf_P(PSTR("%s is %s\r\n"), res->arg1,
(bit & ballboard.flags) ? "on":"off");
}
prog_char str_event_arg0[] = "event";
parse_pgm_token_string_t cmd_event_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_event_result, arg0, str_event_arg0);
-prog_char str_event_arg1[] = "all#encoders#cs#bd#power";
+prog_char str_event_arg1[] = "all#encoders#cs#bd#power#errblock";
parse_pgm_token_string_t cmd_event_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_event_result, arg1, str_event_arg1);
prog_char str_event_arg2[] = "on#off#show";
parse_pgm_token_string_t cmd_event_arg2 = TOKEN_STRING_INITIALIZER(struct cmd_event_result, arg2, str_event_arg2);
.data = NULL, /* 2nd arg of func */
.help_str = help_event,
.tokens = { /* token list, NULL terminated */
- (prog_void *)&cmd_event_arg0,
- (prog_void *)&cmd_event_arg1,
- (prog_void *)&cmd_event_arg2,
+ (prog_void *)&cmd_event_arg0,
+ (prog_void *)&cmd_event_arg1,
+ (prog_void *)&cmd_event_arg2,
NULL,
},
};
.data = NULL, /* 2nd arg of func */
.help_str = help_color,
.tokens = { /* token list, NULL terminated */
- (prog_void *)&cmd_color_arg0,
- (prog_void *)&cmd_color_color,
+ (prog_void *)&cmd_color_arg0,
+ (prog_void *)&cmd_color_color,
NULL,
},
};
};
/* function called when cmd_state3 is parsed successfully */
-static void cmd_state3_parsed(void *parsed_result,
+static void cmd_state3_parsed(void *parsed_result,
__attribute__((unused)) void *data)
{
struct cmd_state3_result *res = parsed_result;
.data = NULL, /* 2nd arg of func */
.help_str = help_state3,
.tokens = { /* token list, NULL terminated */
- (prog_void *)&cmd_state3_arg0,
- (prog_void *)&cmd_state3_arg1,
- (prog_void *)&cmd_state3_arg2,
+ (prog_void *)&cmd_state3_arg0,
+ (prog_void *)&cmd_state3_arg1,
+ (prog_void *)&cmd_state3_arg2,
NULL,
},
};
.data = NULL, /* 2nd arg of func */
.help_str = help_state_machine,
.tokens = { /* token list, NULL terminated */
- (prog_void *)&cmd_state_machine_arg0,
+ (prog_void *)&cmd_state_machine_arg0,
NULL,
},
};
.data = NULL, /* 2nd arg of func */
.help_str = help_state_debug,
.tokens = { /* token list, NULL terminated */
- (prog_void *)&cmd_state_debug_arg0,
- (prog_void *)&cmd_state_debug_on,
+ (prog_void *)&cmd_state_debug_arg0,
+ (prog_void *)&cmd_state_debug_on,
NULL,
},
};
.data = NULL, /* 2nd arg of func */
.help_str = help_fork,
.tokens = { /* token list, NULL terminated */
- (prog_void *)&cmd_fork_arg0,
- (prog_void *)&cmd_fork_arg1,
+ (prog_void *)&cmd_fork_arg0,
+ (prog_void *)&cmd_fork_arg1,
NULL,
},
};
.data = NULL, /* 2nd arg of func */
.help_str = help_roller,
.tokens = { /* token list, NULL terminated */
- (prog_void *)&cmd_roller_arg0,
- (prog_void *)&cmd_roller_arg1,
+ (prog_void *)&cmd_roller_arg0,
+ (prog_void *)&cmd_roller_arg1,
NULL,
},
};
.data = NULL, /* 2nd arg of func */
.help_str = help_test,
.tokens = { /* token list, NULL terminated */
- (prog_void *)&cmd_test_arg0,
+ (prog_void *)&cmd_test_arg0,
NULL,
},
};