]> git.zerfleddert.de Git - rsbs2/blobdiff - bmc/bmc.c
I2C master mode implemented and more decoding
[rsbs2] / bmc / bmc.c
index a0387b339721c1b68f5fd6c907598afd617d5006..525785ec48cf81e3a6dc8d5f836fd902648d0624 100644 (file)
--- a/bmc/bmc.c
+++ b/bmc/bmc.c
@@ -1,27 +1,29 @@
 #include <avr/io.h>
+#include <avr/sleep.h>
+#include <avr/interrupt.h>
 #include <stdio.h>
 #include "usart.h"
+#include "i2c.h"
+#include "bmc.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;
+       while(1) {
+#if 1
+               sleep_mode();
+#endif
        }
 
        return 0;
Impressum, Datenschutz