From 05c282e761efeea640f9277780db0edc6a35ee21 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 12 Apr 2016 18:39:04 +1000 Subject: [PATCH] stm32: fixed build errors with more warnings enabled needed for ArduPilot build --- src/drivers/stm32/drv_input_capture.c | 2 +- src/drivers/stm32/drv_io_timer.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/drivers/stm32/drv_input_capture.c b/src/drivers/stm32/drv_input_capture.c index a2b0cf7629..330404582b 100644 --- a/src/drivers/stm32/drv_input_capture.c +++ b/src/drivers/stm32/drv_input_capture.c @@ -171,7 +171,7 @@ int up_input_capture_set(unsigned channel, input_capture_edge edge, capture_filt input_capture_bind(channel, callback, context); - int rv = io_timer_channel_init(channel, IOTimerChanMode_Capture, input_capture_chan_handler, context); + rv = io_timer_channel_init(channel, IOTimerChanMode_Capture, input_capture_chan_handler, context); if (rv != 0) { return rv; diff --git a/src/drivers/stm32/drv_io_timer.c b/src/drivers/stm32/drv_io_timer.c index 69f9b8a6f0..9fb9393cbb 100644 --- a/src/drivers/stm32/drv_io_timer.c +++ b/src/drivers/stm32/drv_io_timer.c @@ -149,7 +149,7 @@ static int io_timer_handler(uint16_t timer_index) /* Iterate over the timer_io_channels table */ - for (int chan_index = tmr->first_channel_index; chan_index <= tmr->last_channel_index; chan_index++) { + for (unsigned chan_index = tmr->first_channel_index; chan_index <= tmr->last_channel_index; chan_index++) { uint16_t masks = timer_io_channels[chan_index].masks; @@ -249,7 +249,7 @@ static uint32_t get_timer_channels(unsigned timer) const io_timers_t *tmr = &io_timers[timer]; /* Gather the channel bit that belong to the timer */ - for (int chan_index = tmr->first_channel_index; chan_index <= tmr->last_channel_index; chan_index++) { + for (unsigned chan_index = tmr->first_channel_index; chan_index <= tmr->last_channel_index; chan_index++) { channels |= 1 << chan_index; } } @@ -645,7 +645,7 @@ int io_timer_set_enable(bool state, io_timer_channel_mode_t mode, io_timer_chann irqstate_t flags = irqsave(); - for (int actions = 0; actions < arraySize(action_cache) && action_cache[actions].base != 0 ; actions++) { + for (unsigned actions = 0; actions < arraySize(action_cache) && action_cache[actions].base != 0 ; actions++) { uint32_t rvalue = _REG32(action_cache[actions].base, STM32_GTIM_CCER_OFFSET); rvalue &= ~action_cache[actions].ccer_clearbits; rvalue |= action_cache[actions].ccer_setbits; @@ -665,7 +665,7 @@ int io_timer_set_enable(bool state, io_timer_channel_mode_t mode, io_timer_chann /* force an update to preload all registers */ rEGR(actions) = GTIM_EGR_UG; - for (int chan = 0; chan < arraySize(action_cache[actions].gpio); chan++) { + for (unsigned chan = 0; chan < arraySize(action_cache[actions].gpio); chan++) { if (action_cache[actions].gpio[chan]) { stm32_configgpio(action_cache[actions].gpio[chan]); action_cache[actions].gpio[chan] = 0;