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

Committer:
MikkoZ
Date:
Fri Jun 16 11:54:33 2017 +0000
Revision:
13:3d4508874121
Parent:
8:dea50f607a45
Child:
15:726c671efcce
Changes to make bh1790 working.; ; Changed return values and added two separate write commands to choose from. Not tested on other drivers (kx123), so don't update yet if you are not planning to make fixes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikkoZ 13:3d4508874121 1 /*
MikkoZ 13:3d4508874121 2 The MIT License (MIT)
MikkoZ 13:3d4508874121 3 Copyright (c) 2017 Rohm Semiconductor
MikkoZ 8:dea50f607a45 4
MikkoZ 13:3d4508874121 5 Permission is hereby granted, free of charge, to any person obtaining a
MikkoZ 13:3d4508874121 6 copy of this software and associated documentation files (the
MikkoZ 13:3d4508874121 7 "Software"), to deal in the Software without restriction, including
MikkoZ 13:3d4508874121 8 without limitation the rights to use, copy, modify, merge, publish,
MikkoZ 13:3d4508874121 9 distribute, sublicense, and/or sell copies of the Software, and to
MikkoZ 13:3d4508874121 10 permit persons to whom the Software is furnished to do so, subject to
MikkoZ 13:3d4508874121 11 the following conditions:
MikkoZ 8:dea50f607a45 12
MikkoZ 13:3d4508874121 13 The above copyright notice and this permission notice shall be included
MikkoZ 13:3d4508874121 14 in all copies or substantial portions of the Software.
MikkoZ 8:dea50f607a45 15
MikkoZ 13:3d4508874121 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
MikkoZ 13:3d4508874121 17 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MikkoZ 13:3d4508874121 18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
MikkoZ 13:3d4508874121 19 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
MikkoZ 13:3d4508874121 20 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
MikkoZ 13:3d4508874121 21 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MikkoZ 13:3d4508874121 22 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MikkoZ 8:dea50f607a45 23 */
MikkoZ 13:3d4508874121 24
MikkoZ 8:dea50f607a45 25 #ifndef ROHM_HAL_H
MikkoZ 8:dea50f607a45 26 #define ROHM_HAL_H
MikkoZ 8:dea50f607a45 27
MikkoZ 8:dea50f607a45 28 /* This file is meant for making same code work on many platforms easier. */
MikkoZ 8:dea50f607a45 29 #ifdef __MBED__
MikkoZ 8:dea50f607a45 30 /* Mbed Classic */
MikkoZ 8:dea50f607a45 31 #include "mbed.h" //types
MikkoZ 8:dea50f607a45 32 #include "I2C.h" //I2C
MikkoZ 8:dea50f607a45 33
MikkoZ 8:dea50f607a45 34 #define USE_MBED_HARDWARE_I2C
MikkoZ 8:dea50f607a45 35 extern Serial pc;
MikkoZ 8:dea50f607a45 36 //Serial pc(USBTX, USBRX); done in main.cpp
MikkoZ 8:dea50f607a45 37 #define DEBUG_print(...) pc.printf(__VA_ARGS__)
MikkoZ 8:dea50f607a45 38 #define DEBUG_printf(...) pc.printf(__VA_ARGS__)
MikkoZ 8:dea50f607a45 39 #define DEBUG_println(...) pc.printf(__VA_ARGS__);pc.printf("\r\n")
MikkoZ 8:dea50f607a45 40 #endif
MikkoZ 8:dea50f607a45 41
MikkoZ 8:dea50f607a45 42 #if 0 //Enable/disable debug prints
MikkoZ 8:dea50f607a45 43 #define DEBUG_print()
MikkoZ 8:dea50f607a45 44 #define DEBUG_printf()
MikkoZ 8:dea50f607a45 45 #define DEBUG_println()
MikkoZ 8:dea50f607a45 46 #endif
MikkoZ 8:dea50f607a45 47
MikkoZ 8:dea50f607a45 48 #endif /* ROHM_HAL_H */