From 73f9d24446cd04692720dd8325c6ec13155aef58 Mon Sep 17 00:00:00 2001 From: "jino.cho" Date: Wed, 17 May 2017 12:30:55 +0900 Subject: [PATCH] Change data type for parameter to a boolean The parameter('enable') have only two state just like enabled/disabled. Therefore, change it to a boolean. Change-Id: Icefe77a4b62d3e63b882c9106a48134f9036fc16 Signed-off-by: jino.cho --- include/peripheral_gdbus_pwm.h | 4 ++-- include/peripheral_io.h | 9 ++------- src/peripheral_gdbus_pwm.c | 2 +- src/peripheral_io.xml | 4 ++-- src/peripheral_pwm.c | 4 ++-- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/peripheral_gdbus_pwm.h b/include/peripheral_gdbus_pwm.h index 7096af2..59f9d38 100644 --- a/include/peripheral_gdbus_pwm.h +++ b/include/peripheral_gdbus_pwm.h @@ -26,7 +26,7 @@ int peripheral_gdbus_pwm_set_period(peripheral_pwm_h pwm, int period); int peripheral_gdbus_pwm_get_period(peripheral_pwm_h pwm, int *period); int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle); int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle); -int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e enable); -int peripheral_gdbus_pwm_get_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e *enable); +int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, bool enable); +int peripheral_gdbus_pwm_get_enable(peripheral_pwm_h pwm, bool *enable); #endif /* __PERIPHERAL_GDBUS_PWM_H__ */ diff --git a/include/peripheral_io.h b/include/peripheral_io.h index c6838e7..f5bb401 100644 --- a/include/peripheral_io.h +++ b/include/peripheral_io.h @@ -375,11 +375,6 @@ int peripheral_i2c_write(peripheral_i2c_h i2c, uint8_t *data, int length); */ typedef struct _peripheral_pwm_s *peripheral_pwm_h; -typedef enum { - PERIPHERAL_PWM_DISABLE = 0, - PERIPHERAL_PWM_ENABLE, -} peripheral_pwm_state_e; - int peripheral_pwm_open(int device, int channel, peripheral_pwm_h *pwm); int peripheral_pwm_close(peripheral_pwm_h pwm); @@ -393,9 +388,9 @@ 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_set_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e enable); +int peripheral_pwm_set_enable(peripheral_pwm_h pwm, bool enable); -int peripheral_pwm_get_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e *enable); +int peripheral_pwm_get_enable(peripheral_pwm_h pwm, bool *enable); /** * @} diff --git a/src/peripheral_gdbus_pwm.c b/src/peripheral_gdbus_pwm.c index 76f4a5b..cd4f26e 100644 --- a/src/peripheral_gdbus_pwm.c +++ b/src/peripheral_gdbus_pwm.c @@ -187,7 +187,7 @@ int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle) return ret; } -int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e enable) +int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, bool enable) { GError *error = NULL; gint32 ret = PERIPHERAL_ERROR_NONE; diff --git a/src/peripheral_io.xml b/src/peripheral_io.xml index 285c6f5..57ad78d 100644 --- a/src/peripheral_io.xml +++ b/src/peripheral_io.xml @@ -115,12 +115,12 @@ - + - + diff --git a/src/peripheral_pwm.c b/src/peripheral_pwm.c index 45f29fc..07c4001 100644 --- a/src/peripheral_pwm.c +++ b/src/peripheral_pwm.c @@ -100,14 +100,14 @@ int peripheral_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle) return peripheral_gdbus_pwm_get_duty_cycle(pwm, duty_cycle); } -int peripheral_pwm_set_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e enable) +int peripheral_pwm_set_enable(peripheral_pwm_h pwm, bool enable) { if (pwm == NULL) return PERIPHERAL_ERROR_INVALID_PARAMETER; return peripheral_gdbus_pwm_set_enable(pwm, enable); } -int peripheral_pwm_get_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e *enable) +int peripheral_pwm_get_enable(peripheral_pwm_h pwm, bool *enable) { if (pwm == NULL) return PERIPHERAL_ERROR_INVALID_PARAMETER; -- 2.7.4