cleared some Warnings

This commit is contained in:
Olaf Rempel 2008-02-04 19:19:27 +01:00
parent 7b7c950b72
commit 5d47c871fa
3 changed files with 21 additions and 19 deletions

View File

@ -28,12 +28,12 @@ CFLAGS += -MD -MP -MF $(BUILD)/$(*D)/$(*F).d
CFLAGS += -Wall
#CFLAGS += -Wextra
#CFLAGS += -Wcast-align -Wimplicit -Wunused
#CFLAGS += -Wpointer-arith -Wswitch
#CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow
#CFLAGS += -Wbad-function-cast -Wsign-compare -Waggregate-return
CFLAGS += -Wpointer-arith -Wswitch
CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow
CFLAGS += -Wbad-function-cast -Wsign-compare -Waggregate-return
#CFLAGS += -Wcast-qual -Wnested-externs
#CFLAGS += -Wmissing-prototypes
#CFLAGS += -Wstrict-prototypes -Wmissing-declarations
#CFLAGS += -Wmissing-prototypes -Wmissing-declarations
CFLAGS += -Wstrict-prototypes
LDFLAGS = -nostartfiles -t ldscript.ld -Wl,-Map=$@.map,--cref
LDFLAGS += $(patsubst %,-L%,$(LIBDIRS))

View File

@ -50,19 +50,21 @@ struct channel_data {
};
static struct channel_data ch_data[MAX_CHANNELS];
static uint32_t index, count, valid, cal_in_progress;
static uint32_t count, valid, cal_in_progress;
static void ppm_isr(void)
{
static uint32_t i;
/* RC Compare -> no TIOA1 edge for 2.5ms */
uint32_t status = *AT91C_TC1_SR;
if (status & AT91C_TC_CPCS) {
/* average channel count */
count = ((count * 7) + (index << 8)) / 8;
count = ((count * 7) + (i << 8)) / 8;
/* at least 4 channels and a stable channel count */
if ((ROUND_DIV256(count) == index) && (index >= 4)) {
if ((ROUND_DIV256(count) == i) && (i >= 4)) {
if (valid < 10)
valid++;
@ -71,7 +73,7 @@ static void ppm_isr(void)
}
/* reset index */
index = 0;
i = 0;
}
/* edge on TIOA1 */
@ -81,19 +83,19 @@ static void ppm_isr(void)
/* valid range: 1 - 2ms */
if (width > PULSE_MIN && width < PULSE_MAX) {
if (index < ARRAY_SIZE(ch_data)) {
if (i < ARRAY_SIZE(ch_data)) {
/* calc both filters */
ch_data[index].width = ((ch_data[index].width * (PULSE_FILTER_FAST -1)) + width) / PULSE_FILTER_FAST;
ch_data[index].width_slow = ((ch_data[index].width_slow * (PULSE_FILTER_SLOW -1)) + width) / PULSE_FILTER_SLOW;
ch_data[i].width = ((ch_data[i].width * (PULSE_FILTER_FAST -1)) + width) / PULSE_FILTER_FAST;
ch_data[i].width_slow = ((ch_data[i].width_slow * (PULSE_FILTER_SLOW -1)) + width) / PULSE_FILTER_SLOW;
if (cal_in_progress) {
/* use slow filter values, calc center */
ch_data[index].min = MIN(ch_data[index].width_slow, ch_data[index].min);
ch_data[index].max = MAX(ch_data[index].width_slow, ch_data[index].max);
ch_data[index].mid = (ch_data[index].min + ch_data[index].max) / 2;
ch_data[i].min = MIN(ch_data[i].width_slow, ch_data[i].min);
ch_data[i].max = MAX(ch_data[i].width_slow, ch_data[i].max);
ch_data[i].mid = (ch_data[i].min + ch_data[i].max) / 2;
}
}
index++;
i++;
}
}
}

View File

@ -29,7 +29,7 @@ int inline putchar(int c)
struct snprintf_data {
char *bufstart;
size_t buflen;
int pos;
size_t pos;
};
int snprintf_helper(void *base, const char *buf, size_t len)