From e5b65ed040e84dc5f20900b2565c0a8d2a949a20 Mon Sep 17 00:00:00 2001
From: Torben Petersen <petersen@ibr.cs.tu-bs.de>
Date: Mon, 28 Jan 2019 15:33:49 +0100
Subject: [PATCH] Fixes I2C usage

---
 software/main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/software/main.c b/software/main.c
index 019c95b..c869b19 100644
--- a/software/main.c
+++ b/software/main.c
@@ -149,7 +149,7 @@ int shell_temp(int argc, char** argv) {
 
 	i2c_acquire(0);
     //i2c_read_reg(0, 0x48, 0x00, &result);
-	i2c_read_regs(0, 0x48, 0x00, result, 2);
+	i2c_read_regs(0, 0x48, 0x00, result, 2, 0);
 	i2c_release(0);
     //uint16_t temp = (result[0] << 8) | (result[1] >> 4);
 	//printf("temperature is %d %d\n", result[0], result[1]);
@@ -509,11 +509,15 @@ void *send_thread(void *arg)
 
 int main(void)
 {
+    (void) puts("Welcome to RIOT!");
     /// +1 -> INGA working, but TelosB/Sky not
     thread_create(dump_thread_stack, sizeof(dump_thread_stack), THREAD_PRIORITY_MAIN + 1, THREAD_CREATE_STACKTEST, dump_thread, NULL, "dump_thread");
 
-    int res = i2c_init_master(I2C_DEV(0), 2);
-    printf("i2c init: %s\n", res == 0 ? "OK\n" : "FAILED\n");
+    //int res = i2c_init(I2C_DEV(0));
+    #if defined(BOARD_INGA_BLUE) || defined(BOARD_INGA_RED)
+    i2c_init(I2C_DEV(0));
+    #endif
+    //printf("i2c init: %s\n", res == 0 ? "OK\n" : "FAILED\n");
     
     gnrc_netif_t *netif = NULL;
     if((netif = gnrc_netif_iter(netif))) {
-- 
GitLab