From af3f4e67bb387d029922b18e853f3b831d467b77 Mon Sep 17 00:00:00 2001 From: "jino.cho" Date: Tue, 16 May 2017 21:02:51 +0900 Subject: [PATCH] Rename peripheral_pwm_context_h to peripheral_pwm_h Change-Id: I0e39d439d1095502b158b26a8be140aa3cad98fa Signed-off-by: jino.cho --- include/peripheral_gdbus_pwm.h | 14 +++++++------- include/peripheral_io.h | 23 ++++++++++++++--------- src/peripheral_gdbus_pwm.c | 14 +++++++------- src/peripheral_pwm.c | 22 +++++++++++----------- test/peripheral-io-test.c | 4 ++-- 5 files changed, 41 insertions(+), 36 deletions(-) diff --git a/include/peripheral_gdbus_pwm.h b/include/peripheral_gdbus_pwm.h index 2d28514..9a302ef 100644 --- a/include/peripheral_gdbus_pwm.h +++ b/include/peripheral_gdbus_pwm.h @@ -20,12 +20,12 @@ void pwm_proxy_init(void); void pwm_proxy_deinit(void); -int peripheral_gdbus_pwm_open(peripheral_pwm_context_h dev, int device, int channel); -int peripheral_gdbus_pwm_close(peripheral_pwm_context_h dev); -int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_context_h dev, int *duty_cycle); -int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_context_h dev, int duty_cycle); -int peripheral_gdbus_pwm_get_period(peripheral_pwm_context_h dev, int *period); -int peripheral_gdbus_pwm_set_period(peripheral_pwm_context_h dev, int period); -int peripheral_gdbus_pwm_set_enable(peripheral_pwm_context_h dev, peripheral_pwm_state_e enable); +int peripheral_gdbus_pwm_open(peripheral_pwm_h dev, int device, int channel); +int peripheral_gdbus_pwm_close(peripheral_pwm_h dev); +int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h dev, int *duty_cycle); +int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_h dev, int duty_cycle); +int peripheral_gdbus_pwm_get_period(peripheral_pwm_h dev, int *period); +int peripheral_gdbus_pwm_set_period(peripheral_pwm_h dev, int period); +int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h dev, peripheral_pwm_state_e enable); #endif /* __PERIPHERAL_GDBUS_PWM_H__ */ diff --git a/include/peripheral_io.h b/include/peripheral_io.h index a8ed110..a0b7fad 100644 --- a/include/peripheral_io.h +++ b/include/peripheral_io.h @@ -376,28 +376,33 @@ struct _peripheral_pwm_s { int duty_cycle; int enabled; }; -typedef struct _peripheral_pwm_s *peripheral_pwm_context_h; + +/** + * @brief The handle to the pwm device + * @since_tizen 4.0 + */ +typedef struct _peripheral_pwm_s *peripheral_pwm_h; typedef enum { PERIPHERAL_PWM_DISABLE = 0, PERIPHERAL_PWM_ENABLE, } peripheral_pwm_state_e; -peripheral_pwm_context_h peripheral_pwm_open(int device, int channel); +peripheral_pwm_h peripheral_pwm_open(int device, int channel); -int peripheral_pwm_close(peripheral_pwm_context_h pwm); +int peripheral_pwm_close(peripheral_pwm_h pwm); -int peripheral_pwm_set_duty_cycle(peripheral_pwm_context_h pwm, int duty_cycle); +int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle); -int peripheral_pwm_set_period(peripheral_pwm_context_h pwm, int period); +int peripheral_pwm_set_period(peripheral_pwm_h pwm, int period); -int peripheral_pwm_set_enabled(peripheral_pwm_context_h pwm, peripheral_pwm_state_e enable); +int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, peripheral_pwm_state_e enable); -int peripheral_pwm_is_enabled(peripheral_pwm_context_h pwm); +int peripheral_pwm_is_enabled(peripheral_pwm_h pwm); -int peripheral_pwm_get_duty_cycle(peripheral_pwm_context_h pwm, int *duty_cycle); +int peripheral_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle); -int peripheral_pwm_get_period(peripheral_pwm_context_h pwm, int *period); +int peripheral_pwm_get_period(peripheral_pwm_h pwm, int *period); /** diff --git a/src/peripheral_gdbus_pwm.c b/src/peripheral_gdbus_pwm.c index db73dee..66883a2 100644 --- a/src/peripheral_gdbus_pwm.c +++ b/src/peripheral_gdbus_pwm.c @@ -49,7 +49,7 @@ void pwm_proxy_deinit() } } -int peripheral_gdbus_pwm_open(peripheral_pwm_context_h dev, int device, int channel) +int peripheral_gdbus_pwm_open(peripheral_pwm_h dev, int device, int channel) { GError *error = NULL; gint32 ret = PERIPHERAL_ERROR_NONE; @@ -72,7 +72,7 @@ int peripheral_gdbus_pwm_open(peripheral_pwm_context_h dev, int device, int chan return ret; } -int peripheral_gdbus_pwm_close(peripheral_pwm_context_h dev) +int peripheral_gdbus_pwm_close(peripheral_pwm_h dev) { GError *error = NULL; gint32 ret = PERIPHERAL_ERROR_NONE; @@ -95,7 +95,7 @@ int peripheral_gdbus_pwm_close(peripheral_pwm_context_h dev) return ret; } -int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_context_h dev, int *duty_cycle) +int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h dev, int *duty_cycle) { GError *error = NULL; gint32 ret = PERIPHERAL_ERROR_NONE; @@ -118,7 +118,7 @@ int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_context_h dev, int *duty_ return ret; } -int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_context_h dev, int duty_cycle) +int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_h dev, int duty_cycle) { GError *error = NULL; gint32 ret = PERIPHERAL_ERROR_NONE; @@ -142,7 +142,7 @@ int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_context_h dev, int duty_c return ret; } -int peripheral_gdbus_pwm_get_period(peripheral_pwm_context_h dev, int *period) +int peripheral_gdbus_pwm_get_period(peripheral_pwm_h dev, int *period) { GError *error = NULL; gint32 ret = PERIPHERAL_ERROR_NONE; @@ -166,7 +166,7 @@ int peripheral_gdbus_pwm_get_period(peripheral_pwm_context_h dev, int *period) return ret; } -int peripheral_gdbus_pwm_set_period(peripheral_pwm_context_h dev, int period) +int peripheral_gdbus_pwm_set_period(peripheral_pwm_h dev, int period) { GError *error = NULL; gint32 ret = PERIPHERAL_ERROR_NONE; @@ -190,7 +190,7 @@ int peripheral_gdbus_pwm_set_period(peripheral_pwm_context_h dev, int period) return ret; } -int peripheral_gdbus_pwm_set_enable(peripheral_pwm_context_h dev, peripheral_pwm_state_e enable) +int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h dev, peripheral_pwm_state_e enable) { GError *error = NULL; gint32 ret = PERIPHERAL_ERROR_NONE; diff --git a/src/peripheral_pwm.c b/src/peripheral_pwm.c index b3fa3a7..ea08352 100644 --- a/src/peripheral_pwm.c +++ b/src/peripheral_pwm.c @@ -26,19 +26,19 @@ #define PWM_ENABLE 1 #define PWM_DISABLE 0 -peripheral_pwm_context_h peripheral_pwm_open(int device, int channel) +peripheral_pwm_h peripheral_pwm_open(int device, int channel) { - peripheral_pwm_context_h dev = NULL; + peripheral_pwm_h dev = NULL; int ret = PERIPHERAL_ERROR_NONE; assert(device >= 0); assert(channel >= 0); /* Initialize */ - dev = (peripheral_pwm_context_h)malloc(sizeof(struct _peripheral_pwm_s)); + dev = (peripheral_pwm_h)malloc(sizeof(struct _peripheral_pwm_s)); if (dev == NULL) { - _E("Failed to allocate peripheral_pwm_context_h"); + _E("Failed to allocate peripheral_pwm_h"); return NULL; } @@ -57,7 +57,7 @@ peripheral_pwm_context_h peripheral_pwm_open(int device, int channel) return dev; } -int peripheral_pwm_close(peripheral_pwm_context_h pwm) +int peripheral_pwm_close(peripheral_pwm_h pwm) { int ret = PERIPHERAL_ERROR_NONE; @@ -73,7 +73,7 @@ int peripheral_pwm_close(peripheral_pwm_context_h pwm) } -int peripheral_pwm_set_duty_cycle(peripheral_pwm_context_h pwm, int duty_cycle) +int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle) { int ret = PERIPHERAL_ERROR_NONE; @@ -85,7 +85,7 @@ int peripheral_pwm_set_duty_cycle(peripheral_pwm_context_h pwm, int duty_cycle) return ret; } -int peripheral_pwm_set_period(peripheral_pwm_context_h pwm, int period) +int peripheral_pwm_set_period(peripheral_pwm_h pwm, int period) { int ret = PERIPHERAL_ERROR_NONE; @@ -97,7 +97,7 @@ int peripheral_pwm_set_period(peripheral_pwm_context_h pwm, int period) return ret; } -int peripheral_pwm_set_enabled(peripheral_pwm_context_h pwm, peripheral_pwm_state_e enable) +int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, peripheral_pwm_state_e enable) { int ret = PERIPHERAL_ERROR_NONE; @@ -109,7 +109,7 @@ int peripheral_pwm_set_enabled(peripheral_pwm_context_h pwm, peripheral_pwm_stat return PERIPHERAL_ERROR_NONE; } -int peripheral_pwm_is_enabled(peripheral_pwm_context_h pwm) +int peripheral_pwm_is_enabled(peripheral_pwm_h pwm) { if (pwm->enabled == PWM_ENABLE) return PWM_ENABLE; @@ -117,7 +117,7 @@ int peripheral_pwm_is_enabled(peripheral_pwm_context_h pwm) return PWM_DISABLE; } -int peripheral_pwm_get_duty_cycle(peripheral_pwm_context_h pwm, int *duty_cycle) +int peripheral_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle) { int ret = PERIPHERAL_ERROR_NONE; @@ -129,7 +129,7 @@ int peripheral_pwm_get_duty_cycle(peripheral_pwm_context_h pwm, int *duty_cycle) return ret; } -int peripheral_pwm_get_period(peripheral_pwm_context_h pwm, int *period) +int peripheral_pwm_get_period(peripheral_pwm_h pwm, int *period) { int ret = PERIPHERAL_ERROR_NONE; diff --git a/test/peripheral-io-test.c b/test/peripheral-io-test.c index bec2885..21d0a8b 100644 --- a/test/peripheral-io-test.c +++ b/test/peripheral-io-test.c @@ -220,7 +220,7 @@ int pwm_test_led(void) int set_duty_cycle; int get_period, get_duty_cycle; - peripheral_pwm_context_h dev; + peripheral_pwm_h dev; printf("<<< pwm_test >>>\n"); @@ -261,7 +261,7 @@ int pwm_test_motor(void) int duty_cycle = 1500000; int cnt = 0, idx = 0; int degree[3] = {0, 45, 90}; - peripheral_pwm_context_h dev; + peripheral_pwm_h dev; printf("<<< pwm_test_motor >>>\n"); -- 2.34.1