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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rohm_hal2.h Source File

rohm_hal2.h

00001 /*
00002 The MIT License (MIT)
00003 Copyright (c) 2017 Rohm Semiconductor
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a
00006 copy of this software and associated documentation files (the
00007 "Software"), to deal in the Software without restriction, including
00008 without limitation the rights to use, copy, modify, merge, publish,
00009 distribute, sublicense, and/or sell copies of the Software, and to
00010 permit persons to whom the Software is furnished to do so, subject to
00011 the following conditions:
00012 
00013 The above copyright notice and this permission notice shall be included
00014 in all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00017 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00018 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00019 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00020 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00021 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00022 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 */
00024 
00025 #ifndef ROHM_HAL_H
00026 #define ROHM_HAL_H
00027 
00028 /* This file is meant for making same code work on many platforms easier. */
00029 #ifdef __MBED__
00030     /* Mbed Classic */
00031     #include "mbed.h"               //types
00032     #include "I2C.h"                //I2C
00033 
00034     #define USE_MBED_HARDWARE_I2C
00035 #ifdef _DEBUG
00036     #define DEBUG_print(...)    printf(__VA_ARGS__)
00037     #define DEBUG_printf(...)   printf(__VA_ARGS__)
00038     #define DEBUG_println(...)  printf(__VA_ARGS__);printf("\r\n")
00039 #else
00040     #define DEBUG_print(...)
00041     #define DEBUG_printf(...)
00042     #define DEBUG_println(...)
00043 #endif
00044 #endif
00045 
00046 #endif /* ROHM_HAL_H */