2 * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
3 * Author: Brendan Le Foll <brendan.le.foll@intel.com>
4 * Copyright (c) 2014 Intel Corporation.
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 * A structure representing a gpio pin.
35 int pin; /**< the pin number, as known to the os. */
36 int phy_pin; /**< pin passed to clean init. -1 none and raw*/
37 int value_fp; /**< the file pointer to the value of the gpio */
38 void (* isr)(void *); /**< the interupt service request */
39 void *isr_args; /**< args return when interupt service request triggered */
40 pthread_t thread_id; /**< the isr handler thread id */
41 int isr_value_fp; /**< the isr file pointer on the value */
42 mraa_boolean_t owner; /**< If this context originally exported the pin */
46 unsigned int reg_bit_pos;
51 * A structure representing a I2C bus
55 int hz; /**< frequency of communication */
56 int fh; /**< the file handle to the /dev/i2c-* device */
57 int addr; /**< the address of the i2c slave */
62 * A structure representing a PWM pin
66 int pin; /**< the pin number, as known to the os. */
67 int chipid; /**< the chip id, which the pwm resides */
68 int duty_fp; /**< File pointer to duty file */
69 mraa_boolean_t owner; /**< Owner of pwm context*/
74 * A structure representing a Analog Input Channel
77 unsigned int channel; /**< the channel as on board and ADC module */
78 int adc_in_fp; /**< File Pointer to raw sysfs */
79 int value_bit; /**< 10 bits by default. Can be increased if board */