/* pos: channel void *buffer: rt_uint32_t pulse size : number of pulse, only set to sizeof(rt_uint32_t).  */
static rt_size_t _pwm_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
/* pos: channel void *buffer: rt_uint32_t pulse size : number of pulse, only set to sizeof(rt_uint32_t).  */
static rt_size_t _pwm_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
{
    rt_err_t result = RT_EOK;
    struct rt_device_pwm *pwm = (struct rt_device_pwm *)dev;
    rt_uint32_t *pulse = (rt_uint32_t *)buffer;
    struct rt_pwm_configuration configuration = {0};
    configuration.channel = pos;
    if (pwm->ops->control)
    {
        result = pwm->ops->control(pwm, PWM_CMD_GET,  &configuration);
        if (result != RT_EOK)
        {
            return 0;
        }
        *pulse = configuration.pulse;
    }
    return size;
}