| 56 | } |
| 57 | |
| 58 | static rt_err_t get(struct rt_device_pwm *device, struct rt_pwm_configuration *configuration) |
| 59 | { |
| 60 | rt_err_t result = RT_EOK; |
| 61 | struct rt_ls1c_pwm *ls1c_pwm_device = (struct rt_ls1c_pwm *)device; |
| 62 | |
| 63 | if (configuration->channel > (PWM_CHANNEL_MAX - 1)) |
| 64 | { |
| 65 | result = -RT_EIO; |
| 66 | goto _exit; |
| 67 | } |
| 68 | |
| 69 | configuration->period = ls1c_pwm_device->period[configuration->channel]; |
| 70 | configuration->pulse = ls1c_pwm_device->pulse[configuration->channel]; |
| 71 | rt_kprintf("drv_pwm.c get channel %d: period: %d, pulse: %d\n", configuration->channel, configuration->period, configuration->pulse); |
| 72 | |
| 73 | _exit: |
| 74 | return result; |
| 75 | } |
| 76 | |
| 77 | static rt_err_t control(struct rt_device_pwm *device, int cmd, void *arg) |
| 78 | { |