* Allow COPTIM to be set outside Makefile

* Use -Wall -Werror
* Fix some warnings
This commit is contained in:
2011-05-18 09:55:02 +00:00
parent b3f0bbf7c9
commit 4d37c82b12
5 changed files with 7 additions and 6 deletions

View File

@@ -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

4
i2c.c
View File

@@ -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;

4
i2c.h
View File

@@ -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 */

1
main.c
View File

@@ -228,7 +228,6 @@ void average_sample(void)
int main(void) {
int i;
int data;
init_uart();
init_i2c();
init_pins();

1
wmp.c
View File

@@ -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];