add command battery

This commit is contained in:
TT 2019-09-10 21:52:30 +09:00
parent 35dfd691a2
commit be45653c2b
2 changed files with 15 additions and 0 deletions

13
main.c
View file

@ -1603,6 +1603,18 @@ static void cmd_touchtest(BaseSequentialStream *chp, int argc, char *argv[])
} }
static void cmd_battery(BaseSequentialStream *chp, int argc, char *argv[])
{
(void)argc;
(void)argv;
adc_stop(ADC1);
int v = adc_vbat_read(ADC1);
chprintf(chp, "%d\r\n", v);
touch_start_watchdog();
}
static void cmd_frequencies(BaseSequentialStream *chp, int argc, char *argv[]) static void cmd_frequencies(BaseSequentialStream *chp, int argc, char *argv[])
{ {
int i; int i;
@ -1785,6 +1797,7 @@ static const ShellCommand commands[] =
{ "test", cmd_test }, { "test", cmd_test },
{ "touchcal", cmd_touchcal }, { "touchcal", cmd_touchcal },
{ "touchtest", cmd_touchtest }, { "touchtest", cmd_touchtest },
{ "battery", cmd_battery },
{ "pause", cmd_pause }, { "pause", cmd_pause },
{ "resume", cmd_resume }, { "resume", cmd_resume },
{ "cal", cmd_cal }, { "cal", cmd_cal },

View file

@ -315,6 +315,8 @@ int config_recall(void);
void clear_all_config_prop_data(void); void clear_all_config_prop_data(void);
int16_t adc_vbat_read(ADC_TypeDef *adc);
/* /*
* ui.c * ui.c
*/ */