return true;
}
-gboolean handle_pwm_set_duty_cycle(
+gboolean handle_pwm_set_period(
PeripheralIoGdbusPwm *pwm,
GDBusMethodInvocation *invocation,
gint handle,
- gint duty_cycle,
+ gint period,
gpointer user_data)
{
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
pb_pwm_data_h pwm_handle = GUINT_TO_POINTER(handle);
- ret = peripheral_bus_pwm_set_duty_cycle(pwm_handle, duty_cycle);
- peripheral_io_gdbus_pwm_complete_set_duty_cycle(pwm, invocation, ret);
+ ret = peripheral_bus_pwm_set_period(pwm_handle, period);
+ peripheral_io_gdbus_pwm_complete_set_period(pwm, invocation, ret);
return true;
}
-gboolean handle_pwm_set_period(
+gboolean handle_pwm_get_period(
PeripheralIoGdbusPwm *pwm,
GDBusMethodInvocation *invocation,
gint handle,
- gint period,
gpointer user_data)
{
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
pb_pwm_data_h pwm_handle = GUINT_TO_POINTER(handle);
+ int period;
- ret = peripheral_bus_pwm_set_period(pwm_handle, period);
- peripheral_io_gdbus_pwm_complete_set_period(pwm, invocation, ret);
+ ret = peripheral_bus_pwm_get_period(pwm_handle, &period);
+ peripheral_io_gdbus_pwm_complete_get_period(pwm, invocation, period, ret);
return true;
}
-gboolean handle_pwm_set_enable(
+gboolean handle_pwm_set_duty_cycle(
PeripheralIoGdbusPwm *pwm,
GDBusMethodInvocation *invocation,
gint handle,
- gint enable,
+ gint duty_cycle,
gpointer user_data)
{
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
pb_pwm_data_h pwm_handle = GUINT_TO_POINTER(handle);
- ret = peripheral_bus_pwm_set_enable(pwm_handle, enable);
- peripheral_io_gdbus_pwm_complete_set_enable(pwm, invocation, ret);
+ ret = peripheral_bus_pwm_set_duty_cycle(pwm_handle, duty_cycle);
+ peripheral_io_gdbus_pwm_complete_set_duty_cycle(pwm, invocation, ret);
return true;
}
return true;
}
-gboolean handle_pwm_get_period(
+gboolean handle_pwm_set_enable(
PeripheralIoGdbusPwm *pwm,
GDBusMethodInvocation *invocation,
gint handle,
+ gint enable,
gpointer user_data)
{
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
pb_pwm_data_h pwm_handle = GUINT_TO_POINTER(handle);
- int period;
- ret = peripheral_bus_pwm_get_period(pwm_handle, &period);
- peripheral_io_gdbus_pwm_complete_get_period(pwm, invocation, period, ret);
+ ret = peripheral_bus_pwm_set_enable(pwm_handle, enable);
+ peripheral_io_gdbus_pwm_complete_set_enable(pwm, invocation, ret);
return true;
}
G_CALLBACK(handle_pwm_close),
pb_data);
g_signal_connect(pb_data->pwm_skeleton,
- "handle-set-duty-cycle",
- G_CALLBACK(handle_pwm_set_duty_cycle),
- pb_data);
- g_signal_connect(pb_data->pwm_skeleton,
"handle-set-period",
G_CALLBACK(handle_pwm_set_period),
pb_data);
g_signal_connect(pb_data->pwm_skeleton,
- "handle-set-enable",
- G_CALLBACK(handle_pwm_set_enable),
+ "handle-get-period",
+ G_CALLBACK(handle_pwm_get_period),
+ pb_data);
+ g_signal_connect(pb_data->pwm_skeleton,
+ "handle-set-duty-cycle",
+ G_CALLBACK(handle_pwm_set_duty_cycle),
pb_data);
g_signal_connect(pb_data->pwm_skeleton,
"handle-get-duty-cycle",
G_CALLBACK(handle_pwm_get_duty_cycle),
pb_data);
g_signal_connect(pb_data->pwm_skeleton,
- "handle-get-period",
- G_CALLBACK(handle_pwm_get_period),
+ "handle-set-enable",
+ G_CALLBACK(handle_pwm_set_enable),
pb_data);
manager = g_dbus_object_manager_server_new(PERIPHERAL_GDBUS_PWM_PATH);
return PERIPHERAL_ERROR_NONE;
}
-int peripheral_bus_pwm_set_duty_cycle(pb_pwm_data_h pwm, int duty_cycle)
+int peripheral_bus_pwm_set_period(pb_pwm_data_h pwm, int period)
{
- return pwm_set_duty_cycle(pwm->device, pwm->channel, duty_cycle);
+ return pwm_set_period(pwm->device, pwm->channel, period);
}
-int peripheral_bus_pwm_set_period(pb_pwm_data_h pwm, int period)
+int peripheral_bus_pwm_get_period(pb_pwm_data_h pwm, int *period)
{
- return pwm_set_period(pwm->device, pwm->channel, period);
+ return pwm_get_period(pwm->device, pwm->channel, period);
}
-int peripheral_bus_pwm_set_enable(pb_pwm_data_h pwm, int enable)
+int peripheral_bus_pwm_set_duty_cycle(pb_pwm_data_h pwm, int duty_cycle)
{
- return pwm_set_enable(pwm->device, pwm->channel, enable);
+ return pwm_set_duty_cycle(pwm->device, pwm->channel, duty_cycle);
}
int peripheral_bus_pwm_get_duty_cycle(pb_pwm_data_h pwm, int *duty_cycle)
return pwm_get_duty_cycle(pwm->device, pwm->channel, duty_cycle);
}
-int peripheral_bus_pwm_get_period(pb_pwm_data_h pwm, int *period)
+int peripheral_bus_pwm_set_enable(pb_pwm_data_h pwm, int enable)
{
- return pwm_get_period(pwm->device, pwm->channel, period);
+ return pwm_set_enable(pwm->device, pwm->channel, enable);
}
+
int peripheral_bus_pwm_open(int device, int channel, pb_pwm_data_h *pwm, gpointer user_data);
int peripheral_bus_pwm_close(pb_pwm_data_h pwm, gpointer user_data);
-int peripheral_bus_pwm_set_duty_cycle(pb_pwm_data_h pwm, int duty_cycle);
int peripheral_bus_pwm_set_period(pb_pwm_data_h pwm, int period);
-int peripheral_bus_pwm_set_enable(pb_pwm_data_h pwm, int enable);
-int peripheral_bus_pwm_get_duty_cycle(pb_pwm_data_h pwm, int *duty_cycle);
int peripheral_bus_pwm_get_period(pb_pwm_data_h pwm, int *period);
+int peripheral_bus_pwm_set_duty_cycle(pb_pwm_data_h pwm, int duty_cycle);
+int peripheral_bus_pwm_get_duty_cycle(pb_pwm_data_h pwm, int *duty_cycle);
+int peripheral_bus_pwm_set_enable(pb_pwm_data_h pwm, int enable);
#endif /* __PERIPHERAL_BUS_PWM_H__ */
<arg type="u" name="handle" direction="in"/>
<arg type="i" name="result" direction="out"/>
</method>
- <method name="GetDutyCycle">
+ <method name="SetPeriod">
<arg type="u" name="handle" direction="in"/>
- <arg type="i" name="duty_cycle" direction="out"/>
+ <arg type="i" name="period" direction="in"/>
<arg type="i" name="result" direction="out"/>
</method>
- <method name="SetDutyCycle">
+ <method name="GetPeriod">
<arg type="u" name="handle" direction="in"/>
- <arg type="i" name="duty_cycle" direction="in"/>
+ <arg type="i" name="period" direction="out"/>
<arg type="i" name="result" direction="out"/>
</method>
- <method name="GetPeriod">
+ <method name="SetDutyCycle">
<arg type="u" name="handle" direction="in"/>
- <arg type="i" name="period" direction="out"/>
+ <arg type="i" name="duty_cycle" direction="in"/>
<arg type="i" name="result" direction="out"/>
</method>
- <method name="SetPeriod">
+ <method name="GetDutyCycle">
<arg type="u" name="handle" direction="in"/>
- <arg type="i" name="period" direction="in"/>
+ <arg type="i" name="duty_cycle" direction="out"/>
<arg type="i" name="result" direction="out"/>
</method>
<method name="SetEnable">