Rearrange the order of pwm API functions 66/129466/2
authorjino.cho <jino.cho@samsung.com>
Tue, 16 May 2017 10:29:20 +0000 (19:29 +0900)
committerjino.cho <jino.cho@samsung.com>
Tue, 16 May 2017 23:34:55 +0000 (08:34 +0900)
Change-Id: I2adeabd3eb2b085fc2e672e9f4c66436b9acbe30
Signed-off-by: jino.cho <jino.cho@samsung.com>
include/peripheral_gdbus_pwm.h
include/peripheral_io.h
src/peripheral_gdbus_pwm.c
src/peripheral_pwm.c

index 9a302efb1bb34093e0de64c5ad1aca9011dd13d8..2f0be40c88fca27902a4344e18a138bbf26bad02 100644 (file)
@@ -22,10 +22,10 @@ void pwm_proxy_deinit(void);
 
 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_get_period(peripheral_pwm_h dev, int *period);
+int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_h dev, int duty_cycle);
+int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h dev, int *duty_cycle);
 int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h dev, peripheral_pwm_state_e enable);
 
 #endif /* __PERIPHERAL_GDBUS_PWM_H__ */
index 95bc38a4f6fac3acfb2da8a72e7752e8e052f354..e9ee0ea0cb19f1a5593cb6a2e5f0fed978163ca9 100644 (file)
@@ -392,18 +392,18 @@ int peripheral_pwm_open(int device, int channel, peripheral_pwm_h *pwm);
 
 int peripheral_pwm_close(peripheral_pwm_h pwm);
 
-int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle);
 
 int peripheral_pwm_set_period(peripheral_pwm_h pwm, int period);
 
-int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, peripheral_pwm_state_e enable);
+int peripheral_pwm_get_period(peripheral_pwm_h pwm, int *period);
 
-int peripheral_pwm_is_enabled(peripheral_pwm_h pwm);
+int peripheral_pwm_set_duty_cycle(peripheral_pwm_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_h pwm, int *period);
+int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, peripheral_pwm_state_e enable);
 
+int peripheral_pwm_is_enabled(peripheral_pwm_h pwm);
 
 /**
 * @}
index 66883a2bdc70ca4d564985295724ed105c3f13ac..86962a606965439a47b4ae984a19b4a4dad9cb60 100644 (file)
@@ -95,7 +95,7 @@ int peripheral_gdbus_pwm_close(peripheral_pwm_h dev)
        return ret;
 }
 
-int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h dev, int *duty_cycle)
+int peripheral_gdbus_pwm_set_period(peripheral_pwm_h dev, int period)
 {
        GError *error = NULL;
        gint32 ret = PERIPHERAL_ERROR_NONE;
@@ -103,11 +103,11 @@ int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h dev, int *duty_cycle)
        if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
 
        /* TODO: Need to reorganize arguments */
-       if (peripheral_io_gdbus_pwm_call_get_duty_cycle_sync(
+       if (peripheral_io_gdbus_pwm_call_set_period_sync(
                        pwm_proxy,
                        dev->device,
                        dev->channel,
-                       duty_cycle,
+                       period,
                        &ret,
                        NULL,
                        &error) == FALSE) {
@@ -118,7 +118,8 @@ int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h dev, int *duty_cycle)
 
        return ret;
 }
-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)
 {
        GError *error = NULL;
        gint32 ret = PERIPHERAL_ERROR_NONE;
@@ -126,11 +127,11 @@ int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_h dev, int duty_cycle)
        if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
 
        /* TODO: Need to reorganize arguments */
-       if (peripheral_io_gdbus_pwm_call_set_duty_cycle_sync(
+       if (peripheral_io_gdbus_pwm_call_get_period_sync(
                        pwm_proxy,
                        dev->device,
                        dev->channel,
-                       duty_cycle,
+                       period,
                        &ret,
                        NULL,
                        &error) == FALSE) {
@@ -142,7 +143,7 @@ int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_h dev, int duty_cycle)
        return ret;
 }
 
-int peripheral_gdbus_pwm_get_period(peripheral_pwm_h dev, int *period)
+int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_h dev, int duty_cycle)
 {
        GError *error = NULL;
        gint32 ret = PERIPHERAL_ERROR_NONE;
@@ -150,11 +151,11 @@ int peripheral_gdbus_pwm_get_period(peripheral_pwm_h dev, int *period)
        if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
 
        /* TODO: Need to reorganize arguments */
-       if (peripheral_io_gdbus_pwm_call_get_period_sync(
+       if (peripheral_io_gdbus_pwm_call_set_duty_cycle_sync(
                        pwm_proxy,
                        dev->device,
                        dev->channel,
-                       period,
+                       duty_cycle,
                        &ret,
                        NULL,
                        &error) == FALSE) {
@@ -166,7 +167,7 @@ int peripheral_gdbus_pwm_get_period(peripheral_pwm_h dev, int *period)
        return ret;
 }
 
-int peripheral_gdbus_pwm_set_period(peripheral_pwm_h dev, int period)
+int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h dev, int *duty_cycle)
 {
        GError *error = NULL;
        gint32 ret = PERIPHERAL_ERROR_NONE;
@@ -174,11 +175,11 @@ int peripheral_gdbus_pwm_set_period(peripheral_pwm_h dev, int period)
        if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
 
        /* TODO: Need to reorganize arguments */
-       if (peripheral_io_gdbus_pwm_call_set_period_sync(
+       if (peripheral_io_gdbus_pwm_call_get_duty_cycle_sync(
                        pwm_proxy,
                        dev->device,
                        dev->channel,
-                       period,
+                       duty_cycle,
                        &ret,
                        NULL,
                        &error) == FALSE) {
index 9c291b03a918f817404bb834842188ac33dec326..a7c4206ff7a1801eb9751006b10eaceac2253df1 100644 (file)
@@ -74,49 +74,40 @@ int peripheral_pwm_close(peripheral_pwm_h pwm)
        return ret;
 }
 
-
-int    peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle)
+int peripheral_pwm_set_period(peripheral_pwm_h pwm, int period)
 {
        int ret = PERIPHERAL_ERROR_NONE;
 
-       ret = peripheral_gdbus_pwm_set_duty_cycle(pwm, duty_cycle);
+       ret = peripheral_gdbus_pwm_set_period(pwm, period);
 
        if (ret != PERIPHERAL_ERROR_NONE)
-               pwm->duty_cycle = duty_cycle;
+               pwm->period = period;
 
        return ret;
 }
 
-int peripheral_pwm_set_period(peripheral_pwm_h pwm, int period)
+int peripheral_pwm_get_period(peripheral_pwm_h pwm, int *period)
 {
        int ret = PERIPHERAL_ERROR_NONE;
 
-       ret = peripheral_gdbus_pwm_set_period(pwm, period);
+       ret = peripheral_gdbus_pwm_get_period(pwm, period);
 
        if (ret != PERIPHERAL_ERROR_NONE)
-               pwm->period = period;
+               pwm->period = *period;
 
        return ret;
 }
 
-int    peripheral_pwm_set_enabled(peripheral_pwm_h pwm, peripheral_pwm_state_e enable)
+int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle)
 {
        int ret = PERIPHERAL_ERROR_NONE;
 
-       ret = peripheral_gdbus_pwm_set_enable(pwm, enable);
+       ret = peripheral_gdbus_pwm_set_duty_cycle(pwm, duty_cycle);
 
        if (ret != PERIPHERAL_ERROR_NONE)
-               pwm->enabled = enable;
-
-       return PERIPHERAL_ERROR_NONE;
-}
+               pwm->duty_cycle = duty_cycle;
 
-int peripheral_pwm_is_enabled(peripheral_pwm_h pwm)
-{
-       if (pwm->enabled == PWM_ENABLE)
-               return PWM_ENABLE;
-       else
-               return PWM_DISABLE;
+       return ret;
 }
 
 int peripheral_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle)
@@ -131,14 +122,23 @@ int peripheral_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle)
        return ret;
 }
 
-int peripheral_pwm_get_period(peripheral_pwm_h pwm, int *period)
+int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, peripheral_pwm_state_e enable)
 {
        int ret = PERIPHERAL_ERROR_NONE;
 
-       ret = peripheral_gdbus_pwm_get_period(pwm, period);
+       ret = peripheral_gdbus_pwm_set_enable(pwm, enable);
 
        if (ret != PERIPHERAL_ERROR_NONE)
-               pwm->period = *period;
+               pwm->enabled = enable;
 
-       return ret;
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int peripheral_pwm_is_enabled(peripheral_pwm_h pwm)
+{
+       if (pwm->enabled == PWM_ENABLE)
+               return PWM_ENABLE;
+       else
+               return PWM_DISABLE;
 }
+