From 4014b814fb2b92465b9f9759f56c00ccb6c63e9b Mon Sep 17 00:00:00 2001 From: "henryk@ploetzli.ch" Date: Sun, 25 Oct 2009 09:58:23 +0000 Subject: [PATCH] Make canned responsed const --- armsrc/legicrf.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/armsrc/legicrf.c b/armsrc/legicrf.c index 6a40b037..30e2a975 100644 --- a/armsrc/legicrf.c +++ b/armsrc/legicrf.c @@ -16,11 +16,11 @@ static struct legic_frame { uint16_t data; } current_frame; -static struct legic_frame queries[] = { +static const struct legic_frame queries[] = { {7, 0x55}, /* 1010 101 */ }; -static struct legic_frame responses[] = { +static const struct legic_frame responses[] = { {6, 0x3b}, /* 1101 11 */ }; @@ -55,18 +55,19 @@ static void frame_send(uint16_t response, int bits) static void frame_respond(struct legic_frame const * const f) { LED_D_ON(); - int i; - struct legic_frame *r = NULL; + int i, r_size; + uint16_t r_data; for(i=0; ibits == queries[i].bits && f->data == queries[i].data) { - r = &responses[i]; + r_data = responses[i].data; + r_size = responses[i].bits; break; } } - if(r != NULL) { - frame_send(r->data, r->bits); + if(r_size != 0) { + frame_send(r_data, r_size); LED_A_ON(); } else { LED_A_OFF(); -- 2.39.5