From: Michael Gernoth Date: Sun, 22 Aug 2010 14:28:20 +0000 (+0200) Subject: beginning i2c X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/commitdiff_plain/99e4226b74acd4286b735b5da275853701dcacf0 beginning i2c --- diff --git a/bmc/Makefile b/bmc/Makefile index 7915e96..8adc53d 100644 --- a/bmc/Makefile +++ b/bmc/Makefile @@ -7,7 +7,7 @@ PMCU=m16 all: bmc.bin -bmc: bmc.o usart.o +bmc: bmc.o usart.o i2c.o bmc.bin: bmc $(OBJCOPY) -j .text -j .data -O binary $^ $@ diff --git a/bmc/bmc.c b/bmc/bmc.c index a0387b3..c786032 100644 --- a/bmc/bmc.c +++ b/bmc/bmc.c @@ -1,6 +1,8 @@ #include +#include #include #include "usart.h" +#include "i2c.h" int main(void) { @@ -11,6 +13,9 @@ int main(void) DDRB = 0xff; usart_init(); + i2c_init(); + + sei(); printf("Hallo!\n"); diff --git a/bmc/i2c.c b/bmc/i2c.c new file mode 100644 index 0000000..992d6ce --- /dev/null +++ b/bmc/i2c.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include "i2c.h" + +#define TWCR_ACK TWCR = (1<