mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-01 09:24:05 +02:00
fw/antorcha.c: cleanup
- rename "param" to send_param" - move "map" from add_param to compilation unit scope
This commit is contained in:
parent
558f5a7503
commit
fe3ff8d5e1
@ -296,28 +296,29 @@ static struct params params = {
|
|||||||
.tp_bwd_pix = TP_BWD_PIX_DEFAULT,
|
.tp_bwd_pix = TP_BWD_PIX_DEFAULT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct map {
|
||||||
|
const char *name; /* NULL to mark end */
|
||||||
|
void *p;
|
||||||
|
int bytes; /* 1, 2, or 4 */
|
||||||
|
} map[] = {
|
||||||
|
{ "xa_high", ¶ms.xa_high, 2 },
|
||||||
|
{ "xa_low", ¶ms.xa_low, 2 },
|
||||||
|
{ "px_fwd_left", ¶ms.px_fwd_left, 1 },
|
||||||
|
{ "px_bwd_left", ¶ms.px_bwd_left, 1 },
|
||||||
|
{ "px_fwd_right", ¶ms.px_fwd_right, 1 },
|
||||||
|
{ "px_bwd_right", ¶ms.px_bwd_right, 1 },
|
||||||
|
{ "tp_fwd_start", ¶ms.tp_fwd_start, 4 },
|
||||||
|
{ "tp_bwd_start", ¶ms.tp_bwd_start, 4 },
|
||||||
|
{ "tp_fwd_pix", ¶ms.tp_fwd_pix, 2 },
|
||||||
|
{ "tp_bwd_pix", ¶ms.tp_bwd_pix, 2 },
|
||||||
|
{ NULL }
|
||||||
|
};
|
||||||
|
|
||||||
static int have_params = 0;
|
static int have_params = 0;
|
||||||
|
|
||||||
|
|
||||||
static void add_param(const char *arg, const char *eq)
|
static void add_param(const char *arg, const char *eq)
|
||||||
{
|
{
|
||||||
struct map {
|
|
||||||
const char *name; /* NULL to mark end */
|
|
||||||
void *p;
|
|
||||||
int bytes; /* 1, 2, or 4 */
|
|
||||||
} map[] = {
|
|
||||||
{ "xa_high", ¶ms.xa_high, 2 },
|
|
||||||
{ "xa_low", ¶ms.xa_low, 2 },
|
|
||||||
{ "px_fwd_left", ¶ms.px_fwd_left, 1 },
|
|
||||||
{ "px_bwd_left", ¶ms.px_bwd_left, 1 },
|
|
||||||
{ "px_fwd_right", ¶ms.px_fwd_right, 1 },
|
|
||||||
{ "px_bwd_right", ¶ms.px_bwd_right, 1 },
|
|
||||||
{ "tp_fwd_start", ¶ms.tp_fwd_start, 4 },
|
|
||||||
{ "tp_bwd_start", ¶ms.tp_bwd_start, 4 },
|
|
||||||
{ "tp_fwd_pix", ¶ms.tp_fwd_pix, 2 },
|
|
||||||
{ "tp_bwd_pix", ¶ms.tp_bwd_pix, 2 },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
const struct map *m;
|
const struct map *m;
|
||||||
size_t len;
|
size_t len;
|
||||||
unsigned long v;
|
unsigned long v;
|
||||||
@ -355,7 +356,7 @@ static void add_param(const char *arg, const char *eq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void param(struct atrf_dsc *dsc)
|
static void send_param(struct atrf_dsc *dsc)
|
||||||
{
|
{
|
||||||
uint8_t payload[PAYLOAD];
|
uint8_t payload[PAYLOAD];
|
||||||
|
|
||||||
@ -550,7 +551,7 @@ int main(int argc, char **argv)
|
|||||||
usage(*argv);
|
usage(*argv);
|
||||||
if (optind != argc)
|
if (optind != argc)
|
||||||
image(dsc, argv[optind]);
|
image(dsc, argv[optind]);
|
||||||
param(dsc);
|
send_param(dsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user