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_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity);
+int peripheral_gdbus_pwm_get_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e *polarity);
int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, bool enable);
int peripheral_gdbus_pwm_get_enable(peripheral_pwm_h pwm, bool *enable);
*/
typedef struct _peripheral_pwm_s *peripheral_pwm_h;
+/**
+ * @brief Enumeration for Polarity.
+ */
+typedef enum {
+ PERIPHERAL_PWM_POLARITY_NORMAL = 0,
+ PERIPHERAL_PWM_POLARITY_INVERSED,
+} peripheral_pwm_polarity_e;
+
int peripheral_pwm_open(int device, int channel, peripheral_pwm_h *pwm);
int peripheral_pwm_close(peripheral_pwm_h pwm);
int peripheral_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle);
+int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity);
+
+int peripheral_pwm_get_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e *polarity);
+
int peripheral_pwm_set_enable(peripheral_pwm_h pwm, bool enable);
int peripheral_pwm_get_enable(peripheral_pwm_h pwm, bool *enable);
return ret;
}
+int peripheral_gdbus_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity)
+{
+ GError *error = NULL;
+ peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+
+ if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
+
+ if (peripheral_io_gdbus_pwm_call_set_polarity_sync(
+ pwm_proxy,
+ pwm->handle,
+ polarity,
+ &ret,
+ NULL,
+ &error) == FALSE) {
+ _E("%s", error->message);
+ g_error_free(error);
+ return PERIPHERAL_ERROR_UNKNOWN;
+ }
+
+ return ret;
+}
+
+int peripheral_gdbus_pwm_get_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e *polarity)
+{
+ GError *error = NULL;
+ peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+
+ if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
+
+ if (peripheral_io_gdbus_pwm_call_get_polarity_sync(
+ pwm_proxy,
+ pwm->handle,
+ (gint*)polarity,
+ &ret,
+ NULL,
+ &error) == FALSE) {
+ _E("%s", error->message);
+ g_error_free(error);
+ return PERIPHERAL_ERROR_UNKNOWN;
+ }
+
+ return ret;
+}
+
int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, bool enable)
{
GError *error = NULL;
<arg type="i" name="duty_cycle" direction="out"/>
<arg type="i" name="result" direction="out"/>
</method>
+ <method name="SetPolarity">
+ <arg type="u" name="handle" direction="in"/>
+ <arg type="i" name="polarity" direction="in"/>
+ <arg type="i" name="result" direction="out"/>
+ </method>
+ <method name="GetPolarity">
+ <arg type="u" name="handle" direction="in"/>
+ <arg type="i" name="polarity" direction="out"/>
+ <arg type="i" name="result" direction="out"/>
+ </method>
<method name="SetEnable">
<arg type="u" name="handle" direction="in"/>
<arg type="b" name="enable" direction="in"/>
return peripheral_gdbus_pwm_get_duty_cycle(pwm, duty_cycle);
}
+int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity)
+{
+ if (pwm == NULL) return PERIPHERAL_ERROR_INVALID_PARAMETER;
+
+ return peripheral_gdbus_pwm_set_polarity(pwm, polarity);
+}
+
+int peripheral_pwm_get_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e *polarity)
+{
+ if (pwm == NULL) return PERIPHERAL_ERROR_INVALID_PARAMETER;
+
+ return peripheral_gdbus_pwm_get_polarity(pwm, polarity);
+}
+
int peripheral_pwm_set_enable(peripheral_pwm_h pwm, bool enable)
{
if (pwm == NULL) return PERIPHERAL_ERROR_INVALID_PARAMETER;