2 * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef __PERIPHERAL_DBUS_H_
17 #define __PERIPHERAL_DBUS_H_
21 #define PERIPHERAL_DBUS_INTERFACE "org.tizen.peripheral_io"
22 #define PERIPHERAL_DBUS_PATH "/Org/Tizen/Peripheral_io"
23 #define PERIPHERAL_DBUS_GPIO_PATH "/Org/Tizen/Peripheral_io/Gpio"
24 #define PERIPHERAL_DBUS_I2C_PATH "/Org/Tizen/Peripheral_io/I2c"
25 #define PERIPHERAL_DBUS_PWM_PATH "/Org/Tizen/Peripheral_io/Pwm"
26 #define PERIPHERAL_DBUS_NAME "org.tizen.peripheral_io"
28 #define PERIPHERAL_METHOD_GPIO "gpio"
29 #define PERIPHERAL_METHOD_I2C "i2c"
30 #define PERIPHERAL_METHOD_PWM "pwm"
31 #define PERIPHERAL_METHOD_SPI "spi"
32 #define PERIPHERAL_METHOD_UART "uart"
34 void gpio_proxy_init(void);
35 void i2c_proxy_init(void);
36 void pwm_proxy_init(void);
38 void gpio_proxy_deinit();
39 void i2c_proxy_deinit();
40 void pwm_proxy_deinit();
42 int peripheral_dbus_gpio_open(peripheral_gpio_h gpio);
43 int peripheral_dbus_gpio_close(peripheral_gpio_h gpio);
44 int peripheral_dbus_gpio_get_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e *direction);
45 int peripheral_dbus_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e direction);
46 int peripheral_dbus_gpio_read(peripheral_gpio_h gpio, int *value);
47 int peripheral_dbus_gpio_write(peripheral_gpio_h gpio, int value);
48 int peripheral_dbus_gpio_get_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e *edge);
49 int peripheral_dbus_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge);
51 int peripheral_dbus_i2c_open(peripheral_i2c_h i2c, int bus, int address);
52 int peripheral_dbus_i2c_close(peripheral_i2c_h i2c);
53 int peripheral_dbus_i2c_read(peripheral_i2c_h i2c, uint8_t *data, int length);
54 int peripheral_dbus_i2c_write(peripheral_i2c_h i2c, uint8_t *data, int length);
56 int peripheral_dbus_pwm_open(peripheral_pwm_context_h dev, int device, int channel);
57 int peripheral_dbus_pwm_close(peripheral_pwm_context_h dev);
58 int peripheral_dbus_pwm_get_duty_cycle(peripheral_pwm_context_h dev, int *duty_cycle);
59 int peripheral_dbus_pwm_set_duty_cycle(peripheral_pwm_context_h dev, int duty_cycle);
60 int peripheral_dbus_pwm_get_period(peripheral_pwm_context_h dev, int *period);
61 int peripheral_dbus_pwm_set_period(peripheral_pwm_context_h dev, int period);
62 int peripheral_dbus_pwm_set_enable(peripheral_pwm_context_h dev, peripheral_pwm_state_e enable);
64 #endif /* __PERIPHERAL_DBUS_H_ */