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__ */
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);
/**
* @}
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;
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) {
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;
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) {
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;
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) {
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;
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) {
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)
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;
}
+