Add missed logic of iotbus
authorjunmin kim <junmindd.kim@samsung.com>
Tue, 19 Sep 2017 02:40:47 +0000 (19:40 -0700)
committerjunmin kim <junmindd.kim@samsung.com>
Tue, 19 Sep 2017 02:40:47 +0000 (19:40 -0700)
pwm_get_duty_cyle : return pecentage value
gpio_set_direction : ioctl when IOTBUS_GPIO_DIRECTION_NONE

framework/src/iotbus/iotbus_gpio.c
framework/src/iotbus/iotbus_pwm.c

index 26d9b0b..fe8a3cb 100644 (file)
@@ -127,6 +127,8 @@ int iotbus_gpio_set_direction(iotbus_gpio_context_h dev, iotbus_gpio_direction_e
                ret = ioctl(dev->fd, GPIOIOC_SET_DIRECTION, GPIO_DIRECTION_OUT);
                break;
        case IOTBUS_GPIO_DIRECTION_NONE:
+               ret = ioctl(dev->fd, GPIOIOC_SET_DIRECTION, GPIO_DIRECTION_NONE);
+                               break;
        default:
                return IOTBUS_ERROR_INVALID_PARAMETER;
        }
index 248bcfd..0dea418 100644 (file)
@@ -192,8 +192,7 @@ int iotbus_pwm_get_duty_cycle(iotbus_pwm_context_h pwm)
                zdbg("ioctl(PWMIOC_GETCHARACTERISTICS) failed: %d\n", errno);
                return IOTBUS_ERROR_UNKNOWN;
        }
-
-       return (int)(info->duty);
+       return (int)((info->duty * 100.0 / 65536) + 0.5);
 }
 
 int iotbus_pwm_get_period(iotbus_pwm_context_h pwm)