TizenRT Public API  v2.0 M2
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 #ifndef IOTBUS_I2C_H_
32 #define IOTBUS_I2C_H_
33 
34 #include <stdint.h>
35 #include <sys/types.h>
36 
37 struct _iotbus_i2c_s;
38 
42 typedef struct _iotbus_i2c_wrapper_s *iotbus_i2c_context_h;
43 
52 typedef enum {
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
71 
81 
92 
102 int iotbus_i2c_set_address(iotbus_i2c_context_h hnd, uint8_t address);
103 
114 int iotbus_i2c_read(iotbus_i2c_context_h hnd, uint8_t *data, size_t length);
115 
126 int iotbus_i2c_write(iotbus_i2c_context_h hnd, const uint8_t *data, size_t length);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* IOTBUS_I2C_H_ */
133  // 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, size_t length)
writes to i2c device.
int iotbus_i2c_read(iotbus_i2c_context_h hnd, uint8_t *data, size_t length)
reads from i2c device.
int iotbus_i2c_stop(iotbus_i2c_context_h hnd)
closes i2c_context.
int iotbus_i2c_set_address(iotbus_i2c_context_h hnd, uint8_t address)
sets the i2c slave address.
struct _iotbus_i2c_wrapper_s * iotbus_i2c_context_h
Pointer definition to the internal struct _iotbus_i2c_wrapper_s.
Definition: iotbus_i2c.h:42
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:52