From 5c9172ba5681ff93d63c9c263a453d0025170045 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 20 Dec 2013 22:43:18 -0800 Subject: [PATCH] altos: Clean up -Wextra warnings Unused variables, mismatching signed/unsigned and a few other misc warnings. Signed-off-by: Keith Packard --- src/aes/ao_aes.c | 1 + src/core/ao_config.c | 2 ++ src/core/ao_fec.h | 2 +- src/core/ao_gps_report_metrum.c | 3 +-- src/core/ao_log_metrum.c | 1 - src/core/ao_radio_cmac.c | 1 - src/core/ao_telemetry.c | 1 - src/drivers/ao_cc1120.c | 4 ++-- src/drivers/ao_companion.c | 4 ++-- src/drivers/ao_event.c | 2 +- src/drivers/ao_event.h | 2 +- src/drivers/ao_lco_cmd.c | 1 - src/drivers/ao_lco_func.c | 1 - src/drivers/ao_mpu6000.c | 16 ++++++++-------- src/math/ef_rem_pio2.c | 2 +- src/stm/ao_adc_stm.c | 1 + src/stm/ao_exti_stm.c | 5 +++++ src/stm/ao_lcd_stm.c | 3 +-- src/stm/ao_profile.h | 2 +- src/stm/ao_spi_stm_slave.c | 2 +- src/stm/stm32l.h | 6 +++--- src/telelco-v0.2/ao_lco.c | 4 ---- 22 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/aes/ao_aes.c b/src/aes/ao_aes.c index 52463f5d..a04174c6 100644 --- a/src/aes/ao_aes.c +++ b/src/aes/ao_aes.c @@ -367,6 +367,7 @@ static uint8_t iv[16]; void ao_aes_set_mode(enum ao_aes_mode mode) { + (void) mode; /* we only do CBC_MAC anyways... */ } diff --git a/src/core/ao_config.c b/src/core/ao_config.c index 4a1c58b9..590d8a49 100644 --- a/src/core/ao_config.c +++ b/src/core/ao_config.c @@ -658,8 +658,10 @@ ao_config_help(void) __reentrant; static void ao_config_show(void) __reentrant; +#if HAS_EEPROM static void ao_config_save(void) __reentrant; +#endif __code struct ao_config_var ao_config_vars[] = { #if HAS_FLIGHT diff --git a/src/core/ao_fec.h b/src/core/ao_fec.h index eedea8f4..618756c1 100644 --- a/src/core/ao_fec.h +++ b/src/core/ao_fec.h @@ -31,7 +31,7 @@ void ao_fec_dump_bytes(const uint8_t *bytes, uint16_t len, const char *name); #endif -static uint16_t inline +static inline uint16_t ao_fec_crc_byte(uint8_t byte, uint16_t crc) { uint8_t bit; diff --git a/src/core/ao_gps_report_metrum.c b/src/core/ao_gps_report_metrum.c index fa038976..696a833b 100644 --- a/src/core/ao_gps_report_metrum.c +++ b/src/core/ao_gps_report_metrum.c @@ -24,9 +24,8 @@ ao_gps_report_metrum(void) static __xdata struct ao_log_metrum gps_log; static __xdata struct ao_telemetry_location gps_data; static __xdata struct ao_telemetry_satellite gps_tracking_data; - uint8_t c, n, i, p, valid, packets; + uint8_t c, n, i; uint8_t svid; - uint8_t date_reported = 0; uint8_t new; for (;;) { diff --git a/src/core/ao_log_metrum.c b/src/core/ao_log_metrum.c index 43441e7a..91624d98 100644 --- a/src/core/ao_log_metrum.c +++ b/src/core/ao_log_metrum.c @@ -81,7 +81,6 @@ void ao_log(void) { __pdata uint16_t next_sensor, next_other; - uint8_t i; ao_storage_setup(); diff --git a/src/core/ao_radio_cmac.c b/src/core/ao_radio_cmac.c index 3ca3c313..bff848f6 100644 --- a/src/core/ao_radio_cmac.c +++ b/src/core/ao_radio_cmac.c @@ -21,7 +21,6 @@ static __xdata uint8_t ao_radio_cmac_mutex; __pdata int8_t ao_radio_cmac_rssi; static __xdata uint8_t cmac_data[AO_CMAC_MAX_LEN + AO_CMAC_KEY_LEN + 2 + AO_CMAC_KEY_LEN]; -static __pdata uint8_t ao_radio_cmac_len; static uint8_t round_len(uint8_t len) diff --git a/src/core/ao_telemetry.c b/src/core/ao_telemetry.c index e529b717..86158063 100644 --- a/src/core/ao_telemetry.c +++ b/src/core/ao_telemetry.c @@ -211,7 +211,6 @@ ao_send_metrum_data(void) { if (--ao_telemetry_metrum_data_cur <= 0) { __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; - uint8_t i; telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_TELEMETRY_METRUM_DATA; diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index 3429768b..31225939 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -509,7 +509,7 @@ static void ao_radio_set_mode(uint16_t new_mode) { uint16_t changes; - int i; + unsigned int i; if (new_mode == ao_radio_mode) return; @@ -563,7 +563,7 @@ static uint8_t ao_radio_configured = 0; static void ao_radio_setup(void) { - int i; + unsigned int i; ao_radio_strobe(CC1120_SRES); diff --git a/src/drivers/ao_companion.c b/src/drivers/ao_companion.c index 0f405253..570b9e40 100644 --- a/src/drivers/ao_companion.c +++ b/src/drivers/ao_companion.c @@ -67,8 +67,8 @@ ao_companion_get_setup(void) ao_companion_send_command(AO_COMPANION_SETUP); ao_spi_recv(&ao_companion_setup, sizeof (ao_companion_setup), AO_COMPANION_SPI_BUS); COMPANION_DESELECT(); - return (ao_companion_setup.board_id == - (uint16_t) ~ao_companion_setup.board_id_inverse); + return ((int16_t) ao_companion_setup.board_id == + (int16_t) (uint16_t) (~ao_companion_setup.board_id_inverse)); } static void diff --git a/src/drivers/ao_event.c b/src/drivers/ao_event.c index c428125d..5c0d2863 100644 --- a/src/drivers/ao_event.c +++ b/src/drivers/ao_event.c @@ -30,7 +30,7 @@ uint8_t ao_event_queue_insert; uint8_t ao_event_queue_remove; -uint8_t +void ao_event_get(struct ao_event *ev) { ao_arch_critical( diff --git a/src/drivers/ao_event.h b/src/drivers/ao_event.h index ed9a7433..584a845a 100644 --- a/src/drivers/ao_event.h +++ b/src/drivers/ao_event.h @@ -29,7 +29,7 @@ struct ao_event { int32_t value; }; -uint8_t +void ao_event_get(struct ao_event *ev); void diff --git a/src/drivers/ao_lco_cmd.c b/src/drivers/ao_lco_cmd.c index 9c35b324..acbf589a 100644 --- a/src/drivers/ao_lco_cmd.c +++ b/src/drivers/ao_lco_cmd.c @@ -119,7 +119,6 @@ lco_report_cmd(void) __reentrant static void lco_fire_cmd(void) __reentrant { - static __xdata struct ao_pad_command command; uint8_t secs; uint8_t i; int8_t r; diff --git a/src/drivers/ao_lco_func.c b/src/drivers/ao_lco_func.c index 99e58b76..a5d28e61 100644 --- a/src/drivers/ao_lco_func.c +++ b/src/drivers/ao_lco_func.c @@ -26,7 +26,6 @@ static __xdata uint8_t ao_lco_mutex; int8_t ao_lco_query(uint16_t box, struct ao_pad_query *query, uint16_t *tick_offset) { - uint8_t i; int8_t r; uint16_t sent_time; diff --git a/src/drivers/ao_mpu6000.c b/src/drivers/ao_mpu6000.c index 0689d7a7..c0458027 100644 --- a/src/drivers/ao_mpu6000.c +++ b/src/drivers/ao_mpu6000.c @@ -132,7 +132,7 @@ ao_mpu6000_gyro(int16_t v) #endif static uint8_t -ao_mpu6000_accel_check(int16_t normal, int16_t test, char *which) +ao_mpu6000_accel_check(int16_t normal, int16_t test) { int16_t diff = test - normal; @@ -146,7 +146,7 @@ ao_mpu6000_accel_check(int16_t normal, int16_t test, char *which) } static uint8_t -ao_mpu6000_gyro_check(int16_t normal, int16_t test, char *which) +ao_mpu6000_gyro_check(int16_t normal, int16_t test) { int16_t diff = test - normal; @@ -292,13 +292,13 @@ _ao_mpu6000_setup(void) ao_delay(AO_MS_TO_TICKS(200)); _ao_mpu6000_sample(&normal_mode); - errors += ao_mpu6000_accel_check(normal_mode.accel_x, test_mode.accel_x, "x"); - errors += ao_mpu6000_accel_check(normal_mode.accel_y, test_mode.accel_y, "y"); - errors += ao_mpu6000_accel_check(normal_mode.accel_z, test_mode.accel_z, "z"); + errors += ao_mpu6000_accel_check(normal_mode.accel_x, test_mode.accel_x); + errors += ao_mpu6000_accel_check(normal_mode.accel_y, test_mode.accel_y); + errors += ao_mpu6000_accel_check(normal_mode.accel_z, test_mode.accel_z); - errors += ao_mpu6000_gyro_check(normal_mode.gyro_x, test_mode.gyro_x, "x"); - errors += ao_mpu6000_gyro_check(normal_mode.gyro_y, test_mode.gyro_y, "y"); - errors += ao_mpu6000_gyro_check(normal_mode.gyro_z, test_mode.gyro_z, "z"); + errors += ao_mpu6000_gyro_check(normal_mode.gyro_x, test_mode.gyro_x); + errors += ao_mpu6000_gyro_check(normal_mode.gyro_y, test_mode.gyro_y); + errors += ao_mpu6000_gyro_check(normal_mode.gyro_z, test_mode.gyro_z); if (!errors) break; } diff --git a/src/math/ef_rem_pio2.c b/src/math/ef_rem_pio2.c index f1191d09..3e58f809 100644 --- a/src/math/ef_rem_pio2.c +++ b/src/math/ef_rem_pio2.c @@ -142,7 +142,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ fn = (float)n; r = t-fn*pio2_1; w = fn*pio2_1t; /* 1st round good to 40 bit */ - if(n<32&&(ix&0xffffff00)!=npio2_hw[n-1]) { + if(n<32&&(ix&(__int32_t)0xffffff00)!=npio2_hw[n-1]) { y[0] = r-w; /* quick check no cancellation */ } else { __uint32_t high; diff --git a/src/stm/ao_adc_stm.c b/src/stm/ao_adc_stm.c index 505addfa..53d4b8c3 100644 --- a/src/stm/ao_adc_stm.c +++ b/src/stm/ao_adc_stm.c @@ -41,6 +41,7 @@ static uint8_t ao_adc_ready; */ static void ao_adc_done(int index) { + (void) index; AO_DATA_PRESENT(AO_DATA_ADC); ao_dma_done_transfer(STM_DMA_INDEX(STM_DMA_CHANNEL_ADC1)); if (ao_data_present == AO_DATA_ALL) { diff --git a/src/stm/ao_exti_stm.c b/src/stm/ao_exti_stm.c index c1dcdf85..35958cf8 100644 --- a/src/stm/ao_exti_stm.c +++ b/src/stm/ao_exti_stm.c @@ -119,6 +119,8 @@ ao_exti_setup (struct stm_gpio *gpio, uint8_t pin, uint8_t mode, void (*callback void ao_exti_set_mode(struct stm_gpio *gpio, uint8_t pin, uint8_t mode) { + (void) gpio; + uint32_t mask = 1 << pin; if (mode & AO_EXTI_MODE_RISING) @@ -133,12 +135,14 @@ ao_exti_set_mode(struct stm_gpio *gpio, uint8_t pin, uint8_t mode) { void ao_exti_set_callback(struct stm_gpio *gpio, uint8_t pin, void (*callback)()) { + (void) gpio; ao_exti_callback[pin] = callback; } void ao_exti_enable(struct stm_gpio *gpio, uint8_t pin) { uint32_t mask = (1 << pin); + (void) gpio; stm_exti.pr = mask; stm_exti.imr |= (1 << pin); } @@ -146,6 +150,7 @@ ao_exti_enable(struct stm_gpio *gpio, uint8_t pin) { void ao_exti_disable(struct stm_gpio *gpio, uint8_t pin) { uint32_t mask = (1 << pin); + (void) gpio; stm_exti.imr &= ~mask; stm_exti.pr = mask; } diff --git a/src/stm/ao_lcd_stm.c b/src/stm/ao_lcd_stm.c index 47ea374e..95af53d1 100644 --- a/src/stm/ao_lcd_stm.c +++ b/src/stm/ao_lcd_stm.c @@ -346,8 +346,7 @@ static const struct ao_cmds ao_lcd_stm_cmds[] = { void ao_lcd_stm_init(void) { - int s, c; - int r; + unsigned int s, c; uint32_t csr; stm_rcc.ahbenr |= ((AO_LCD_STM_USES_GPIOA << STM_RCC_AHBENR_GPIOAEN) | diff --git a/src/stm/ao_profile.h b/src/stm/ao_profile.h index f7dd029d..f8a0c25e 100644 --- a/src/stm/ao_profile.h +++ b/src/stm/ao_profile.h @@ -20,7 +20,7 @@ void ao_profile_init(); -static uint32_t inline ao_profile_tick(void) { +static inline uint32_t ao_profile_tick(void) { uint16_t hi, lo, second_hi; do { diff --git a/src/stm/ao_spi_stm_slave.c b/src/stm/ao_spi_stm_slave.c index 98022442..962ff2c6 100644 --- a/src/stm/ao_spi_stm_slave.c +++ b/src/stm/ao_spi_stm_slave.c @@ -97,7 +97,6 @@ ao_spi_slave_send(void *block, uint16_t len) ao_dma_done_transfer(miso_dma_index); } - uint8_t ao_spi_slave_recv(void *block, uint16_t len) { @@ -153,6 +152,7 @@ ao_spi_slave_recv(void *block, uint16_t len) ao_dma_done_transfer(mosi_dma_index); ao_dma_done_transfer(miso_dma_index); + return 1; } static void diff --git a/src/stm/stm32l.h b/src/stm/stm32l.h index ff3f5336..302f4d24 100644 --- a/src/stm/stm32l.h +++ b/src/stm/stm32l.h @@ -52,7 +52,7 @@ stm_moder_set(struct stm_gpio *gpio, int pin, vuint32_t value) { value << STM_MODER_SHIFT(pin)); } -static inline vuint32_t +static inline uint32_t stm_moder_get(struct stm_gpio *gpio, int pin) { return (gpio->moder >> STM_MODER_SHIFT(pin)) & STM_MODER_MASK; } @@ -69,7 +69,7 @@ stm_otyper_set(struct stm_gpio *gpio, int pin, vuint32_t value) { value << STM_OTYPER_SHIFT(pin)); } -static inline vuint32_t +static inline uint32_t stm_otyper_get(struct stm_gpio *gpio, int pin) { return (gpio->otyper >> STM_OTYPER_SHIFT(pin)) & STM_OTYPER_MASK; } @@ -88,7 +88,7 @@ stm_ospeedr_set(struct stm_gpio *gpio, int pin, vuint32_t value) { value << STM_OSPEEDR_SHIFT(pin)); } -static inline vuint32_t +static inline uint32_t stm_ospeedr_get(struct stm_gpio *gpio, int pin) { return (gpio->ospeedr >> STM_OSPEEDR_SHIFT(pin)) & STM_OSPEEDR_MASK; } diff --git a/src/telelco-v0.2/ao_lco.c b/src/telelco-v0.2/ao_lco.c index e8d16ca9..0bbb76f1 100644 --- a/src/telelco-v0.2/ao_lco.c +++ b/src/telelco-v0.2/ao_lco.c @@ -37,7 +37,6 @@ static uint8_t ao_lco_debug; #define AO_LCO_BOX_DIGIT_10 2 static uint8_t ao_lco_min_box, ao_lco_max_box; -static uint8_t ao_lco_mutex; static uint8_t ao_lco_pad; static uint8_t ao_lco_box; static uint8_t ao_lco_armed; @@ -281,12 +280,9 @@ static void ao_lco_igniter_status(void) { uint8_t c; - uint16_t delay; for (;;) { -// ao_alarm(delay); ao_sleep(&ao_pad_query); -// ao_clear_alarm(); if (!ao_lco_valid) { ao_led_on(AO_LED_RED); ao_led_off(AO_LED_GREEN|AO_LED_AMBER); -- 2.30.2