mirror of
https://github.com/whowechina/chu_pico.git
synced 2025-01-19 09:37:24 +01:00
Update command in CLI
This commit is contained in:
parent
482b4c0669
commit
e715864e54
@ -6,6 +6,7 @@
|
||||
|
||||
#include "pico/stdio.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/bootrom.h"
|
||||
#include "cli.h"
|
||||
#include "save.h"
|
||||
|
||||
@ -86,6 +87,13 @@ static void handle_fps(int argc, char *argv[])
|
||||
{
|
||||
printf("FPS: core 0: %d, core 1: %d\n", fps[0], fps[1]);
|
||||
}
|
||||
static void handle_update(int argc, char *argv[])
|
||||
{
|
||||
printf("Boot into update mode.\n");
|
||||
fflush(stdout);
|
||||
sleep_ms(100);
|
||||
reset_usb_boot(0, 2);
|
||||
}
|
||||
|
||||
int cli_extract_non_neg_int(const char *param, int len)
|
||||
{
|
||||
@ -181,4 +189,5 @@ void cli_init(const char *prompt, const char *logo)
|
||||
|
||||
cli_register("?", handle_help, "Display this help message.");
|
||||
cli_register("fps", handle_fps, "Display FPS.");
|
||||
cli_register("update", handle_update, "Update firmware.");
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
typedef void (*cmd_handler_t)(int argc, char *argv[]);
|
||||
|
||||
void cli_init();
|
||||
void cli_init(const char *prompt, const char *logo);
|
||||
void cli_register(const char *cmd, cmd_handler_t handler, const char *help);
|
||||
void cli_run();
|
||||
void cli_fps_count(int core);
|
||||
|
Loading…
x
Reference in New Issue
Block a user