MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / get

Function get

bsp/loongson/ls1cdev/drivers/drv_pwm.c:58–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58static 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
77static rt_err_t control(struct rt_device_pwm *device, int cmd, void *arg)
78{

Callers 1

controlFunction · 0.70

Calls 1

rt_kprintfFunction · 0.85

Tested by

no test coverage detected