From b442ffba40cef5fa5a5e1bd6c13b5e30b06b28e2 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 27 May 2014 15:48:57 +0200 Subject: Fix compiler warnings --- Makefile | 2 +- accel.c | 6 +++--- accel.h | 6 +++--- common.h | 2 ++ gyro.c | 6 +++--- gyro.h | 6 +++--- i2c.c | 3 +++ speaker.c | 2 +- uart.c | 6 ++++-- 9 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 1c28676..335cc51 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ MCU = atmega88 -CFLAGS=-Os +CFLAGS=-Os -Wall -Wextra all: sanduhr.hex diff --git a/accel.c b/accel.c index 2a73b40..3a6c595 100644 --- a/accel.c +++ b/accel.c @@ -180,15 +180,15 @@ bool accelProcess () { return false; } -const int8_t accelGetZ () { +int8_t accelGetZ () { return zval; } -const uint8_t accelGetShakeCount () { +uint8_t accelGetShakeCount () { return shakeCount; } -const horizon accelGetHorizon () { +horizon accelGetHorizon () { return horizonSign; } diff --git a/accel.h b/accel.h index 3aba602..4e53160 100644 --- a/accel.h +++ b/accel.h @@ -9,9 +9,9 @@ typedef enum {HORIZON_NONE, HORIZON_POS, HORIZON_NEG} horizon; void accelInit (); void accelStart (); bool accelProcess (); -const int8_t accelGetZ (); -const uint8_t accelGetShakeCount (); -const horizon accelGetHorizon (); +int8_t accelGetZ (); +uint8_t accelGetShakeCount (); +horizon accelGetHorizon (); #endif /* ACCEL_H */ diff --git a/common.h b/common.h index eba8d6e..fed4dbd 100644 --- a/common.h +++ b/common.h @@ -9,5 +9,7 @@ while (cond) { sleep_cpu (); } \ sleep_disable (); +#define __unused__ __attribute__ ((unused)) + #endif /* COMMON_H */ diff --git a/gyro.c b/gyro.c index 0333e86..b9cba41 100644 --- a/gyro.c +++ b/gyro.c @@ -111,7 +111,7 @@ bool gyroProcess () { return false; } -const int32_t gyroGetZAccum () { +int32_t gyroGetZAccum () { return zaccum; } @@ -119,11 +119,11 @@ void gyroResetZAccum () { zaccum = 0; } -volatile const int16_t gyroGetZRaw () { +int16_t gyroGetZRaw () { return zval; } -const int8_t gyroGetZTicks () { +int8_t gyroGetZTicks () { return zticks; } diff --git a/gyro.h b/gyro.h index c55d8dd..9297a6f 100644 --- a/gyro.h +++ b/gyro.h @@ -8,9 +8,9 @@ void gyroInit (); void gyroStart (); bool gyroProcess (); void gyroResetAccum (); -const int32_t gyroGetZAccum (); -volatile const int16_t gyroGetZRaw (); -const int8_t gyroGetZTicks (); +int32_t gyroGetZAccum (); +int16_t gyroGetZRaw (); +int8_t gyroGetZTicks (); #endif /* GYROSCOPE_H */ diff --git a/i2c.c b/i2c.c index 3e4bffb..84479a1 100644 --- a/i2c.c +++ b/i2c.c @@ -30,9 +30,12 @@ static void twFlushContRaw () { TWCR = (TWCR & ~((1 << TWSTA) | (1 << TWSTO))) | (1 << TWIE) | (1 << TWINT) | (1 << TWEN) | (1 << TWEA); } +#if 0 +/* unused */ static void twWaitRaw () { while (!(TWCR & (1 << TWINT))); } +#endif static bool twWriteRaw (const uint8_t data) { TWDR = data; diff --git a/speaker.c b/speaker.c index d903c57..2eace8d 100644 --- a/speaker.c +++ b/speaker.c @@ -37,7 +37,7 @@ void speakerStart () { /* enable overflow interrupt */ TIMSK2 = (1 << TOIE2); /* io clock with 1024 prescaler */ - TCCR2B = (TCCR2B & ~((1 << CS21)) | (1 << CS22) | (1 << CS20)); + TCCR2B = ((TCCR2B & ~(1 << CS21)) | (1 << CS22) | (1 << CS20)); } void speakerStop () { diff --git a/uart.c b/uart.c index 3528a22..2eebe16 100644 --- a/uart.c +++ b/uart.c @@ -13,7 +13,7 @@ static void uartSend (unsigned char data) { UDR0 = data; } -static int uartPutc (char c, FILE *stream) { +static int uartPutc (char c, FILE *stream __unused__) { if (c == '\n') { uartSend ('\r'); } @@ -48,10 +48,12 @@ void uartInit () { stdout = &mystdout; } +#if 0 +/* unused */ static unsigned char uartReceive () { /* Wait for data to be received */ while ( !(UCSR0A & (1<