Change-Id: I3b62a841edaafe2298592132cb2fdd8ed23a9694
Signed-off-by: jino.cho <jino.cho@samsung.com>
PERIPHERAL_PWM_ENABLE,
} peripheral_pwm_state_e;
PERIPHERAL_PWM_ENABLE,
} peripheral_pwm_state_e;
-peripheral_pwm_h peripheral_pwm_open(int device, int channel);
+int peripheral_pwm_open(int device, int channel, peripheral_pwm_h *pwm);
int peripheral_pwm_close(peripheral_pwm_h pwm);
int peripheral_pwm_close(peripheral_pwm_h pwm);
#define PWM_ENABLE 1
#define PWM_DISABLE 0
#define PWM_ENABLE 1
#define PWM_DISABLE 0
-peripheral_pwm_h peripheral_pwm_open(int device, int channel)
+int peripheral_pwm_open(int device, int channel, peripheral_pwm_h* pwm)
{
peripheral_pwm_h dev = NULL;
int ret = PERIPHERAL_ERROR_NONE;
{
peripheral_pwm_h dev = NULL;
int ret = PERIPHERAL_ERROR_NONE;
if (dev == NULL) {
_E("Failed to allocate peripheral_pwm_h");
if (dev == NULL) {
_E("Failed to allocate peripheral_pwm_h");
+ return PERIPHERAL_ERROR_OUT_OF_MEMORY;
ret = peripheral_gdbus_pwm_open(dev, device, channel);
if (ret != PERIPHERAL_ERROR_NONE) {
ret = peripheral_gdbus_pwm_open(dev, device, channel);
if (ret != PERIPHERAL_ERROR_NONE) {
+ _E("PWM open error (%d, %d)", device, channel);
}
int peripheral_pwm_close(peripheral_pwm_h pwm)
}
int peripheral_pwm_close(peripheral_pwm_h pwm)
printf("<<< pwm_test >>>\n");
printf("<<< pwm_test >>>\n");
- dev = peripheral_pwm_open(device, channel);
+ peripheral_pwm_open(device, channel, &dev);
peripheral_pwm_set_period(dev, period); /* period: nanosecond */
peripheral_pwm_set_duty_cycle(dev, duty_cycle); /* duty_cycle: nanosecond */
peripheral_pwm_set_enabled(dev, 1); /* 0: disable, 1: enable */
peripheral_pwm_set_period(dev, period); /* period: nanosecond */
peripheral_pwm_set_duty_cycle(dev, duty_cycle); /* duty_cycle: nanosecond */
peripheral_pwm_set_enabled(dev, 1); /* 0: disable, 1: enable */
printf("<<< pwm_test_motor >>>\n");
printf("<<< pwm_test_motor >>>\n");
- dev = peripheral_pwm_open(device, channel);
+ peripheral_pwm_open(device, channel, &dev);
for (cnt = 0; cnt < 5; cnt++) {
for (idx = 0; idx < 3; idx++) {
switch (degree[idx]) {
for (cnt = 0; cnt < 5; cnt++) {
for (idx = 0; idx < 3; idx++) {
switch (degree[idx]) {