diff options
author | Jin Yoon <jinny.yoon@samsung.com> | 2017-04-27 09:31:57 +0900 |
---|---|---|
committer | Jin Yoon <jinny.yoon@samsung.com> | 2017-04-27 09:31:57 +0900 |
commit | 08d7f88205f03bf903cd1c5f3a9f8101fed979ce (patch) | |
tree | ebb5a83761b9f563b11f2fd8b1008d27f21fbffc | |
parent | 3e0192f0752cd4a3d3ad326c445fa1b5288c9629 (diff) | |
download | thing-toggler-master.tar.gz thing-toggler-master.tar.bz2 thing-toggler-master.zip |
API changes : GPIOHEADtizen_4.0.m1_releasesubmit/tizen_4.0_unified/20170814.115522submit/tizen_4.0/20170828.110001submit/tizen_4.0/20170828.100001submit/tizen_4.0/20170814.115522submit/tizen_4.0/20170811.094300submit/tizen/20170502.013414accepted/tizen/unified/20170502.041153accepted/tizen/4.0/unified/20170828.224144accepted/tizen/4.0/unified/20170816.015211accepted/tizen/4.0/unified/20170816.012243master
-rw-r--r-- | src/thing_toggler.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/thing_toggler.c b/src/thing_toggler.c index d77141e..f80b73a 100644 --- a/src/thing_toggler.c +++ b/src/thing_toggler.c @@ -62,10 +62,10 @@ static void service_app_low_memory(app_event_info_h event_info, void *user_data) /*APP_EVENT_LOW_MEMORY*/ } -static void _control_led(peripheral_gpio_context_h dev, int power_on) +static void _control_led(peripheral_gpio_h gpio, int power_on) { dlog_print(DLOG_INFO, LOG_TAG, "Write [%d] into GPIO."); - peripheral_gpio_write(dev, power_on); + peripheral_gpio_write(gpio, power_on); } static gboolean _toggle_led(gpointer user_data) @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) char ad[50] = {0,}; service_app_lifecycle_callback_s event_callback; app_event_handler_h handlers[5] = {NULL, }; - peripheral_gpio_context_h dev = NULL; + peripheral_gpio_h gpio = NULL; guint timer_id = 0; int ret = 0; @@ -98,20 +98,20 @@ int main(int argc, char* argv[]) service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); - dev = peripheral_gpio_open(GPIO_NUM); - if (!dev) { + peripheral_gpio_open(GPIO_NUM, &gpio); + if (!gpio) { dlog_print(DLOG_INFO, LOG_TAG, "The return value of peripheral_gpio_open is null."); return 1; } - ret = peripheral_gpio_set_direction(dev, PERIPHERAL_GPIO_DIRECTION_OUT); + ret = peripheral_gpio_set_direction(gpio, PERIPHERAL_GPIO_DIRECTION_OUT); if (ret != 0) { dlog_print(DLOG_INFO, LOG_TAG, "Cannot set direction error."); return 1; } // Return value : the ID (greater than 0) of the event source. - timer_id = g_timeout_add_seconds(1, _toggle_led, dev); + timer_id = g_timeout_add_seconds(1, _toggle_led, gpio); if (timer_id <= 0) { dlog_print(DLOG_INFO, LOG_TAG, "Timer id : %d", timer_id); return 1; @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) ret = service_app_main(argc, argv, &event_callback, ad); g_source_remove(timer_id); - peripheral_gpio_close(dev); + peripheral_gpio_close(gpio); return ret; } |