Class for making communication easier from code to i2c connected Rohm/Kionix sensors. Maybe could be used later also for abstracting Arduino/mbed os. Code ported from 'C'-library rohm-sensor-hal.

Dependents:   kionix-kx123-hello rohm-bh1790glc-hello simple-sensor-client rohm-SensorShield-example

Fork of rohm-sensor-hal by Rohm

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Wed Feb 27 04:43:21 2019 +0000
Parent:
14:f33e0914ea36
Commit message:
Fix debug print

Changed in this revision

RegisterWriter/rohm_hal2.h Show annotated file Show diff for this revision Revisions of this file
--- a/RegisterWriter/rohm_hal2.h	Mon Feb 18 14:26:35 2019 +0900
+++ b/RegisterWriter/rohm_hal2.h	Wed Feb 27 04:43:21 2019 +0000
@@ -32,17 +32,15 @@
     #include "I2C.h"                //I2C
 
     #define USE_MBED_HARDWARE_I2C
-    extern Serial pc;
-    //Serial pc(USBTX, USBRX); done in main.cpp
-    #define DEBUG_print(...)    pc.printf(__VA_ARGS__)
-    #define DEBUG_printf(...)   pc.printf(__VA_ARGS__)
-    #define DEBUG_println(...)  pc.printf(__VA_ARGS__);pc.printf("\r\n")
+#ifdef _DEBUG
+    #define DEBUG_print(...)    printf(__VA_ARGS__)
+    #define DEBUG_printf(...)   printf(__VA_ARGS__)
+    #define DEBUG_println(...)  printf(__VA_ARGS__);printf("\r\n")
+#else
+    #define DEBUG_print(...)
+    #define DEBUG_printf(...)
+    #define DEBUG_println(...)
 #endif
-
-#if 0       //Enable/disable debug prints
-    #define DEBUG_print()
-    #define DEBUG_printf()
-    #define DEBUG_println()
 #endif
 
 #endif /* ROHM_HAL_H */