Hello world for Rohm BH1726 ALS dual channel sensor. Uses Rohm sensor hal and bh1726 driver.

Dependencies:   mbed rohm-bh1726 rohm-sensor-hal

Fork of rohm-bh1745-hello by Rohm

Revision:
5:a8feb1b6e6b5
Parent:
4:a9efa968de28
Child:
7:0baf8142fdef
--- a/main_classic.cpp	Mon Sep 12 12:34:04 2016 +0000
+++ b/main_classic.cpp	Wed Sep 14 07:17:13 2016 +0000
@@ -16,27 +16,27 @@
 #include "rohm-sensor-hal/rohm-sensor-hal/rohm_hal.h"       //mbed.h, types, DEBUG_print*
 #include "rohm-sensor-hal/rohm-sensor-hal/I2CCommon.h"
 
-#include "rohm-bh1745/rohm-bh1745/bh1745_driver.h"
-#include "rohm-bh1745/rohm-bh1745/bh1745.h"
+#include "rohm-bh1726/rohm-bh1726/bh1726_driver.h"
+#include "rohm-bh1726/rohm-bh1726/bh1726.h"
 
 Serial pc(USBTX, USBRX);
 
-void bh1745_print_raw_values(){
-    pc.printf("\nbh1745 library test program.\n\r");
+void bh1726_print_raw_values(){
+    pc.printf("\nbh1726 library test program.\n\r");
     I2CCommonBegin();
 
-    bh1745_wait_until_found();
-    pc.printf("\nSensor found.\n\r");
-    bh1745_initial_setup();
+    bh1726_wait_until_found();
+    bh1726_initial_setup();
     wait(1);
+//    bh1726_dumpregs(BH1726_REGISTER_DUMP_START, BH1726_REGISTER_DUMP_END);
     
     while(1) {
         bool error;
-        uint16_t data[4];       //4 channels of 16-bit data
+        uint16_t data[2];       //2 channels of 16-bit data
 
-        error = bh1745_read_data(&data[0]);
+        error = bh1726_read_data(&data[0]);
         if (!error) {
-            pc.printf("Red[%4u], Green[%4u], Blue[%4u], Clear[%4u]\n\r", data[0], data[1], data[2], data[3]);
+            pc.printf("ALS Data0[%4u], Data1[%4u]\n\r", data[0], data[1]);
             }
         else {
             pc.printf("\n\r");
@@ -47,6 +47,6 @@
 
 
 int main() {
-    bh1745_print_raw_values();
+    bh1726_print_raw_values();
     }