Rohm / rohm-sensor-hal

Dependents:   rohm-bm1383-hello-mbedclassic rohm-bh1726-hello rohm-rpr0521-hello rohm-bh1745-hello ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers I2CCommon.h Source File

I2CCommon.h

00001 /*   Copyright 2016 Rohm Semiconductor
00002 
00003    Licensed under the Apache License, Version 2.0 (the "License");
00004    you may not use this file except in compliance with the License.
00005    You may obtain a copy of the License at
00006 
00007        http://www.apache.org/licenses/LICENSE-2.0
00008 
00009    Unless required by applicable law or agreed to in writing, software
00010    distributed under the License is distributed on an "AS IS" BASIS,
00011    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012    See the License for the specific language governing permissions and
00013    limitations under the License.
00014 */
00015 #ifndef i2c_common_h
00016 #define i2c_common_h
00017 /*  i2c common functions 
00018     This interface is the same for Arduino hardware i2c lib Wire, Arduino software i2c lib SoftI2CMaster and mbed hardware lib I2C.
00019     Choosing between them is done by compile time using flags, for mbed use USE_MBED_HARDWARE_I2C -flag.
00020     Note: This method doesn't allow multiple i2c busses to be used at same time.
00021 */
00022 #include "rohm_hal.h"       //types, DEBUG_print*, USE_*_HARDWARE_I2C
00023 
00024 bool I2CCommonBegin();
00025 uint8_t read_register(uint8_t sad, uint8_t reg, uint8_t* buf, uint8_t buf_len);
00026 void write_registers(uint8_t sad, uint8_t reg, uint8_t* data, uint8_t data_len);
00027 void write_register(uint8_t sad, uint8_t reg, uint8_t data);
00028 bool change_bits(uint8_t sad, uint8_t reg, uint8_t mask, uint8_t bits);
00029 
00030 #endif
00031 
00032