Tizen RT Public API  v1.0 D5
iotbus_i2c.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 
31 #include <stdint.h>
32 
33 #ifndef IOTBUS_I2C_H_
34 #define IOTBUS_I2C_H_
35 
36 struct _iotbus_i2c_s;
37 
41 typedef struct _iotbus_i2c_s *iotbus_i2c_context_h;
42 
51 typedef enum {
56 
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
70 
79 
89 
98 int iotbus_i2c_set_address(iotbus_i2c_context_h hnd, uint8_t address);
99 
109 int iotbus_i2c_read(iotbus_i2c_context_h hnd, uint8_t *data, int length);
110 
120 int iotbus_i2c_write(iotbus_i2c_context_h hnd, const uint8_t *data, int length);
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* IOTBUS_I2C_H_ */
127  // end of I2C group
int iotbus_i2c_set_frequency(iotbus_i2c_context_h hnd, iotbus_i2c_mode_e mode)
sets the i2c frequency.
int iotbus_i2c_write(iotbus_i2c_context_h hnd, const uint8_t *data, int length)
writes to i2c device.
int iotbus_i2c_stop(iotbus_i2c_context_h hnd)
closes i2c_context.
struct _iotbus_i2c_s * iotbus_i2c_context_h
Pointer definition to the internal struct _iotbus_i2c_s.
Definition: iotbus_i2c.h:41
int iotbus_i2c_set_address(iotbus_i2c_context_h hnd, uint8_t address)
sets the i2c slave address.
int iotbus_i2c_read(iotbus_i2c_context_h hnd, uint8_t *data, int length)
reads from i2c device.
iotbus_i2c_context_h iotbus_i2c_init(int bus)
initializes i2c_context.
iotbus_i2c_mode_e
Enumeration of I2C frequency mode.
Definition: iotbus_i2c.h:51