]> cvs.zerfleddert.de Git - rsbs2/blobdiff - bmc/bmc.c
working i2c connection to RSBS2-card
[rsbs2] / bmc / bmc.c
index a0387b339721c1b68f5fd6c907598afd617d5006..d7c5cdc95ec4d1c4028112f188b6547e7320b081 100644 (file)
--- a/bmc/bmc.c
+++ b/bmc/bmc.c
@@ -1,27 +1,30 @@
 #include <avr/io.h>
+#include <avr/sleep.h>
+#include <avr/interrupt.h>
 #include <stdio.h>
 #include "usart.h"
+#include "i2c.h"
 
 int main(void)
 {
-       uint8_t pb = 0x00;
-       int8_t dir = 1;
-       volatile uint16_t i;
-
        DDRB = 0xff;
+       PORTB = 0xff;
 
        usart_init();
+       printf("\n");
 
-       printf("Hallo!\n");
+       i2c_init();
 
-       while(1) {
-               pb += dir;
-               PORTB = pb;
+       printf("Waiting for I2C...\n");
 
-               for (i = 0; i < (pb<<5); i++) {}
+       sei();
 
-               if ((pb == 0) || (pb == 0xff))
-                       dir = -dir;
+       PORTB = 0xff;
+
+       while(1) {
+#if 1
+               sleep_mode();
+#endif
        }
 
        return 0;
Impressum, Datenschutz