![](/media/cache/profiles/5f14615696649541a025d3d0f8e0447f.jpg.50x50_q85.jpg)
テスト用です。
MPU6050_wallbotble/myi2c/myi2c_api.h@0:8468a4403fea, 2016-10-11 (annotated)
- Committer:
- jksoft
- Date:
- Tue Oct 11 11:09:42 2016 +0000
- Revision:
- 0:8468a4403fea
SB??ver;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:8468a4403fea | 1 | /* mbed Microcontroller Library |
jksoft | 0:8468a4403fea | 2 | * Copyright (c) 2006-2013 ARM Limited |
jksoft | 0:8468a4403fea | 3 | * |
jksoft | 0:8468a4403fea | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jksoft | 0:8468a4403fea | 5 | * you may not use this file except in compliance with the License. |
jksoft | 0:8468a4403fea | 6 | * You may obtain a copy of the License at |
jksoft | 0:8468a4403fea | 7 | * |
jksoft | 0:8468a4403fea | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jksoft | 0:8468a4403fea | 9 | * |
jksoft | 0:8468a4403fea | 10 | * Unless required by applicable law or agreed to in writing, software |
jksoft | 0:8468a4403fea | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jksoft | 0:8468a4403fea | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jksoft | 0:8468a4403fea | 13 | * See the License for the specific language governing permissions and |
jksoft | 0:8468a4403fea | 14 | * limitations under the License. |
jksoft | 0:8468a4403fea | 15 | */ |
jksoft | 0:8468a4403fea | 16 | #ifndef MBED_I2C_API_H |
jksoft | 0:8468a4403fea | 17 | #define MBED_I2C_API_H |
jksoft | 0:8468a4403fea | 18 | |
jksoft | 0:8468a4403fea | 19 | #include "device.h" |
jksoft | 0:8468a4403fea | 20 | |
jksoft | 0:8468a4403fea | 21 | //#if DEVICE_I2C |
jksoft | 0:8468a4403fea | 22 | |
jksoft | 0:8468a4403fea | 23 | #ifdef __cplusplus |
jksoft | 0:8468a4403fea | 24 | extern "C" { |
jksoft | 0:8468a4403fea | 25 | #endif |
jksoft | 0:8468a4403fea | 26 | |
jksoft | 0:8468a4403fea | 27 | typedef struct i2c_s i2c_t; |
jksoft | 0:8468a4403fea | 28 | |
jksoft | 0:8468a4403fea | 29 | enum { |
jksoft | 0:8468a4403fea | 30 | I2C_ERROR_NO_SLAVE = -1, |
jksoft | 0:8468a4403fea | 31 | I2C_ERROR_BUS_BUSY = -2 |
jksoft | 0:8468a4403fea | 32 | }; |
jksoft | 0:8468a4403fea | 33 | |
jksoft | 0:8468a4403fea | 34 | void i2c_init (i2c_t *obj, PinName sda, PinName scl); |
jksoft | 0:8468a4403fea | 35 | void i2c_frequency (i2c_t *obj, int hz); |
jksoft | 0:8468a4403fea | 36 | int i2c_start (i2c_t *obj); |
jksoft | 0:8468a4403fea | 37 | int i2c_stop (i2c_t *obj); |
jksoft | 0:8468a4403fea | 38 | int i2c_read (i2c_t *obj, int address, char *data, int length, int stop); |
jksoft | 0:8468a4403fea | 39 | int i2c_write (i2c_t *obj, int address, const char *data, int length, int stop); |
jksoft | 0:8468a4403fea | 40 | void i2c_reset (i2c_t *obj); |
jksoft | 0:8468a4403fea | 41 | int i2c_byte_read (i2c_t *obj, int last); |
jksoft | 0:8468a4403fea | 42 | int i2c_byte_write (i2c_t *obj, int data); |
jksoft | 0:8468a4403fea | 43 | |
jksoft | 0:8468a4403fea | 44 | #if DEVICE_I2CSLAVE |
jksoft | 0:8468a4403fea | 45 | void i2c_slave_mode (i2c_t *obj, int enable_slave); |
jksoft | 0:8468a4403fea | 46 | int i2c_slave_receive(i2c_t *obj); |
jksoft | 0:8468a4403fea | 47 | int i2c_slave_read (i2c_t *obj, char *data, int length); |
jksoft | 0:8468a4403fea | 48 | int i2c_slave_write (i2c_t *obj, const char *data, int length); |
jksoft | 0:8468a4403fea | 49 | void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask); |
jksoft | 0:8468a4403fea | 50 | #endif |
jksoft | 0:8468a4403fea | 51 | |
jksoft | 0:8468a4403fea | 52 | #ifdef __cplusplus |
jksoft | 0:8468a4403fea | 53 | } |
jksoft | 0:8468a4403fea | 54 | #endif |
jksoft | 0:8468a4403fea | 55 | |
jksoft | 0:8468a4403fea | 56 | //#endif |
jksoft | 0:8468a4403fea | 57 | |
jksoft | 0:8468a4403fea | 58 | #endif |