From 4d37c82b1212787f2e7589ce2efcee641164ea99 Mon Sep 17 00:00:00 2001 From: Gavan Fantom Date: Wed, 18 May 2011 09:55:02 +0000 Subject: [PATCH] * Allow COPTIM to be set outside Makefile * Use -Wall -Werror * Fix some warnings --- Makefile | 3 ++- i2c.c | 4 ++-- i2c.h | 4 ++-- main.c | 1 - wmp.c | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f09cf45..09a5b5d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ NAME=quad SSRCS=crt0.s CSRCS=main.c i2c.c wmp.c timer.c -CFLAGS=-march=armv4t -msoft-float -O1 +COPTIM?=-O1 +CFLAGS=-march=armv4t -msoft-float $(COPTIM) -Wall -Werror LDSCRIPT=lpc2103_flash.ld CC=arm-elf-gcc diff --git a/i2c.c b/i2c.c index b03541f..45bb3a3 100644 --- a/i2c.c +++ b/i2c.c @@ -79,7 +79,7 @@ bool i2c_send_address(int addr, bool write) return i2c_send_data((addr<<1) + (write?0:1)); } -bool i2c_send_data(int data) +bool i2c_send_data(unsigned int data) { IREG(I2DAT) = data; IREG(I2CONCLR) = STAFLAG | STOFLAG | SIFLAG; @@ -94,7 +94,7 @@ bool i2c_send_data(int data) } } -bool i2c_receive_data(int *data, bool last) +bool i2c_receive_data(unsigned int *data, bool last) { if (!last) IREG(I2CONSET) = AAFLAG; diff --git a/i2c.h b/i2c.h index 5bb81aa..6746acf 100644 --- a/i2c.h +++ b/i2c.h @@ -10,8 +10,8 @@ int i2c_conreg(void); int i2c_statreg(void); bool i2c_send_start(void); bool i2c_send_address(int addr, bool write); -bool i2c_send_data(int data); -bool i2c_receive_data(int *data, bool last); +bool i2c_send_data(unsigned int data); +bool i2c_receive_data(unsigned int *data, bool last); void i2c_send_stop(void); #endif /* __I2C_H */ diff --git a/main.c b/main.c index 38e8712..aac509e 100644 --- a/main.c +++ b/main.c @@ -228,7 +228,6 @@ void average_sample(void) int main(void) { int i; - int data; init_uart(); init_i2c(); init_pins(); diff --git a/wmp.c b/wmp.c index 2292cf9..44d0e0f 100644 --- a/wmp.c +++ b/wmp.c @@ -13,6 +13,7 @@ bool wmp_init(void) if (!i2c_send_data(0x04)) return FALSE; i2c_send_stop(); + return TRUE; } unsigned char wmp_calibration_data[0x20];