2010-09-24 02:50:02 -03:00
|
|
|
|
|
|
|
#include <AP_Common.h>
|
2012-12-11 20:23:02 -04:00
|
|
|
#include <AP_Math.h>
|
|
|
|
#include <AP_Param.h>
|
2014-08-13 09:12:08 -03:00
|
|
|
#include <StorageManager.h>
|
2012-11-12 17:12:40 -04:00
|
|
|
#include <AP_Progmem.h>
|
2012-12-11 20:23:02 -04:00
|
|
|
|
2012-10-19 00:49:36 -03:00
|
|
|
#include <AP_Menu.h>
|
2012-11-12 17:12:40 -04:00
|
|
|
#include <AP_HAL.h>
|
|
|
|
#include <AP_HAL_AVR.h>
|
2010-09-24 02:50:02 -03:00
|
|
|
|
2012-12-18 21:26:58 -04:00
|
|
|
const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
|
2010-09-24 02:50:02 -03:00
|
|
|
|
2010-12-19 22:34:46 -04:00
|
|
|
int8_t
|
2010-09-24 02:50:02 -03:00
|
|
|
menu_test(uint8_t argc, const Menu::arg *argv)
|
|
|
|
{
|
2012-08-17 03:18:11 -03:00
|
|
|
int i;
|
2010-09-24 02:50:02 -03:00
|
|
|
|
2012-11-12 17:12:40 -04:00
|
|
|
hal.console->printf("This is a test with %d arguments\n", argc);
|
2011-10-28 15:43:43 -03:00
|
|
|
for (i = 1; i < argc; i++) {
|
2012-11-12 17:12:40 -04:00
|
|
|
hal.console->printf("%d: int %ld float ", i, argv[i].i);
|
|
|
|
hal.console->println(argv[i].f, 6); // gross
|
2011-10-28 15:43:43 -03:00
|
|
|
}
|
2012-12-18 20:18:08 -04:00
|
|
|
return 0;
|
2010-09-24 02:50:02 -03:00
|
|
|
}
|
|
|
|
|
2010-12-19 22:34:46 -04:00
|
|
|
int8_t
|
2010-09-24 03:18:59 -03:00
|
|
|
menu_auto(uint8_t argc, const Menu::arg *argv)
|
|
|
|
{
|
2012-11-12 17:12:40 -04:00
|
|
|
hal.console->println("auto text");
|
2012-12-18 20:18:08 -04:00
|
|
|
return 0;
|
2010-09-24 03:18:59 -03:00
|
|
|
}
|
|
|
|
|
2010-09-24 02:50:02 -03:00
|
|
|
const struct Menu::command top_menu_commands[] PROGMEM = {
|
2011-10-28 15:43:43 -03:00
|
|
|
{"*", menu_auto},
|
2012-08-17 03:18:11 -03:00
|
|
|
{"test", menu_test},
|
2010-09-24 02:50:02 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
MENU(top, "menu", top_menu_commands);
|
|
|
|
|
|
|
|
void
|
|
|
|
setup(void)
|
|
|
|
{
|
2012-11-12 17:12:40 -04:00
|
|
|
hal.console->println_P(PSTR("AP_Menu unit test"));
|
2011-10-28 15:43:43 -03:00
|
|
|
top.run();
|
2010-09-24 02:50:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
loop(void)
|
|
|
|
{
|
2013-01-16 15:55:44 -04:00
|
|
|
hal.console->printf("not reached\n");
|
2010-09-24 02:50:02 -03:00
|
|
|
}
|
|
|
|
|
2012-11-12 17:12:40 -04:00
|
|
|
AP_HAL_MAIN();
|