iio: Improve iio channel parsing to add enabled channels
[contrib/mraa.git] / include / mraa_func.h
1 /*
2  * Author: Henry Bruce <henry.bruce@intel.com>
3  * Copyright (c) 2015 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24
25 #pragma once
26
27 #include "common.h"
28 #include "mraa.h"
29 #include "types.h"
30
31 typedef struct {
32     mraa_i2c_context (*i2c_init_raw) (unsigned int bus);
33     mraa_result_t (*i2c_frequency) (mraa_i2c_context dev, mraa_i2c_mode_t mode);
34     mraa_result_t (*i2c_address) (mraa_i2c_context dev, uint8_t addr);
35     int (*i2c_read) (mraa_i2c_context dev, uint8_t* data, int length);
36     uint8_t (*i2c_read_byte) (mraa_i2c_context dev);
37     uint8_t (*i2c_read_byte_data) (mraa_i2c_context dev, const uint8_t command);
38     uint16_t (*i2c_read_word_data) (mraa_i2c_context dev, const uint8_t command);
39     int (*i2c_read_bytes_data) (mraa_i2c_context dev, uint8_t command, uint8_t* data, int length);
40     mraa_result_t (*i2c_write) (mraa_i2c_context dev, const uint8_t* data, int length);
41     mraa_result_t (*i2c_write_byte) (mraa_i2c_context dev, const uint8_t data);
42     mraa_result_t (*i2c_write_byte_data) (mraa_i2c_context dev, const uint8_t data, const uint8_t command);
43     mraa_result_t (*i2c_write_word_data) (mraa_i2c_context dev, const uint16_t data, const uint8_t command);
44     mraa_result_t (*i2c_stop) (mraa_i2c_context dev);
45 } mraa_i2c_func_t;
46
47
48 typedef struct {
49     mraa_i2c_func_t* i2c;
50 } mraa_func_t;
51