Platform HAL for rohm sensor drivers. Used for abstracting Arduino/mbed os/mbed classic.
Dependents: rohm-bm1383-hello-mbedclassic rohm-bh1726-hello rohm-rpr0521-hello rohm-bh1745-hello ... more
rohm-sensor-hal/I2CCommon.h@9:aecd1e03720a, 2019-02-27 (annotated)
- Committer:
- MACRUM
- Date:
- Wed Feb 27 04:43:34 2019 +0000
- Revision:
- 9:aecd1e03720a
- Parent:
- 0:38c206f19bb7
Fix debug print
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikkoZ | 0:38c206f19bb7 | 1 | /* Copyright 2016 Rohm Semiconductor |
MikkoZ | 0:38c206f19bb7 | 2 | |
MikkoZ | 0:38c206f19bb7 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
MikkoZ | 0:38c206f19bb7 | 4 | you may not use this file except in compliance with the License. |
MikkoZ | 0:38c206f19bb7 | 5 | You may obtain a copy of the License at |
MikkoZ | 0:38c206f19bb7 | 6 | |
MikkoZ | 0:38c206f19bb7 | 7 | http://www.apache.org/licenses/LICENSE-2.0 |
MikkoZ | 0:38c206f19bb7 | 8 | |
MikkoZ | 0:38c206f19bb7 | 9 | Unless required by applicable law or agreed to in writing, software |
MikkoZ | 0:38c206f19bb7 | 10 | distributed under the License is distributed on an "AS IS" BASIS, |
MikkoZ | 0:38c206f19bb7 | 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MikkoZ | 0:38c206f19bb7 | 12 | See the License for the specific language governing permissions and |
MikkoZ | 0:38c206f19bb7 | 13 | limitations under the License. |
MikkoZ | 0:38c206f19bb7 | 14 | */ |
MikkoZ | 0:38c206f19bb7 | 15 | #ifndef i2c_common_h |
MikkoZ | 0:38c206f19bb7 | 16 | #define i2c_common_h |
MikkoZ | 0:38c206f19bb7 | 17 | /* i2c common functions |
MikkoZ | 0:38c206f19bb7 | 18 | This interface is the same for Arduino hardware i2c lib Wire, Arduino software i2c lib SoftI2CMaster and mbed hardware lib I2C. |
MikkoZ | 0:38c206f19bb7 | 19 | Choosing between them is done by compile time using flags, for mbed use USE_MBED_HARDWARE_I2C -flag. |
MikkoZ | 0:38c206f19bb7 | 20 | Note: This method doesn't allow multiple i2c busses to be used at same time. |
MikkoZ | 0:38c206f19bb7 | 21 | */ |
MikkoZ | 0:38c206f19bb7 | 22 | #include "rohm_hal.h" //types, DEBUG_print*, USE_*_HARDWARE_I2C |
MikkoZ | 0:38c206f19bb7 | 23 | |
MikkoZ | 0:38c206f19bb7 | 24 | bool I2CCommonBegin(); |
MikkoZ | 0:38c206f19bb7 | 25 | uint8_t read_register(uint8_t sad, uint8_t reg, uint8_t* buf, uint8_t buf_len); |
MikkoZ | 0:38c206f19bb7 | 26 | void write_registers(uint8_t sad, uint8_t reg, uint8_t* data, uint8_t data_len); |
MikkoZ | 0:38c206f19bb7 | 27 | void write_register(uint8_t sad, uint8_t reg, uint8_t data); |
MikkoZ | 0:38c206f19bb7 | 28 | bool change_bits(uint8_t sad, uint8_t reg, uint8_t mask, uint8_t bits); |
MikkoZ | 0:38c206f19bb7 | 29 | |
MikkoZ | 0:38c206f19bb7 | 30 | #endif |
MikkoZ | 0:38c206f19bb7 | 31 | |
MikkoZ | 0:38c206f19bb7 | 32 |