add frequencies command

This commit is contained in:
TT 2017-01-02 17:32:48 +09:00
parent a76698c166
commit bd2890e6af

20
main.c
View file

@ -245,7 +245,6 @@ static const I2SConfig i2sconfig = {
static void cmd_data(BaseSequentialStream *chp, int argc, char *argv[]) static void cmd_data(BaseSequentialStream *chp, int argc, char *argv[])
{ {
int i; int i;
int len;
int sel = 0; int sel = 0;
if (argc == 1) if (argc == 1)
@ -615,7 +614,7 @@ const struct open_model {
float c3; float c3;
} open_model = { 50, 0, -300, 27 }; } open_model = { 50, 0, -300, 27 };
#if 1 #if 0
static void static void
adjust_ed(void) adjust_ed(void)
{ {
@ -978,12 +977,12 @@ my_atof(const char *p)
if (*p == '-' || *p == '+') if (*p == '-' || *p == '+')
p++; p++;
float x = atoi(p); float x = atoi(p);
while (isdigit(*p)) while (isdigit((int)*p))
p++; p++;
if (*p == '.') { if (*p == '.') {
float d = 1.0f; float d = 1.0f;
p++; p++;
while (isdigit(*p)) { while (isdigit((int)*p)) {
d /= 10; d /= 10;
x += d * (*p - '0'); x += d * (*p - '0');
p++; p++;
@ -1138,6 +1137,18 @@ static void cmd_touchcal(BaseSequentialStream *chp, int argc, char *argv[])
touch_start_watchdog(); touch_start_watchdog();
} }
static void cmd_frequencies(BaseSequentialStream *chp, int argc, char *argv[])
{
int i;
(void)chp;
(void)argc;
(void)argv;
for (i = 0; i < sweep_points; i++) {
chprintf(chp, "%d\r\n", frequencies[i]);
}
}
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[])
{ {
(void)chp; (void)chp;
@ -1273,6 +1284,7 @@ static const ShellCommand commands[] =
{ "dac", cmd_dac }, { "dac", cmd_dac },
{ "data", cmd_data }, { "data", cmd_data },
{ "dump", cmd_dump }, { "dump", cmd_dump },
{ "frequencies", cmd_frequencies },
{ "port", cmd_port }, { "port", cmd_port },
{ "stat", cmd_stat }, { "stat", cmd_stat },
{ "gain", cmd_gain }, { "gain", cmd_gain },