|
@@ -203,55 +203,4 @@ int rt_hw_pwm_init(void)
|
|
|
|
|
|
INIT_DEVICE_EXPORT(rt_hw_pwm_init);
|
|
INIT_DEVICE_EXPORT(rt_hw_pwm_init);
|
|
|
|
|
|
-
|
|
|
|
-#ifdef RT_USING_FINSH
|
|
|
|
-#include <finsh.h>
|
|
|
|
-
|
|
|
|
-#ifdef FINSH_USING_MSH
|
|
|
|
-
|
|
|
|
-rt_err_t rt_pwm_get(struct rt_device_pwm *device, int channel)
|
|
|
|
-{
|
|
|
|
- rt_err_t result = RT_EOK;
|
|
|
|
- struct rt_pwm_configuration configuration = {0};
|
|
|
|
-
|
|
|
|
- if (!device)
|
|
|
|
- {
|
|
|
|
- return -RT_EIO;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- configuration.channel = channel;
|
|
|
|
- result = rt_device_control(&device->parent, PWM_CMD_GET, &configuration);
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int pwm_get(int argc, char **argv)
|
|
|
|
-{
|
|
|
|
- int result = 0;
|
|
|
|
- struct rt_device_pwm *device = RT_NULL;
|
|
|
|
-
|
|
|
|
- if (argc != 3)
|
|
|
|
- {
|
|
|
|
- rt_kprintf("Usage: pwm_get pwm1 1\n");
|
|
|
|
- result = -RT_ERROR;
|
|
|
|
- goto _exit;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- device = (struct rt_device_pwm *)rt_device_find(argv[1]);
|
|
|
|
- if (!device)
|
|
|
|
- {
|
|
|
|
- result = -RT_EIO;
|
|
|
|
- goto _exit;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- result = rt_pwm_get(device, atoi(argv[2]));
|
|
|
|
-
|
|
|
|
-_exit:
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-MSH_CMD_EXPORT(pwm_get, pwm_get pwm1 1);
|
|
|
|
-
|
|
|
|
-#endif /* FINSH_USING_MSH */
|
|
|
|
-#endif /* RT_USING_FINSH */
|
|
|
|
-
|
|
|
|
#endif /* RT_USING_PWM */
|
|
#endif /* RT_USING_PWM */
|