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

Function _pwm_control

bsp/raspberry-pico/Drivers/drv_pwm.c:168–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168static rt_err_t _pwm_control(struct rt_device_pwm *device, int cmd, void *arg)
169{
170 struct pico_pwm *_pwm = rt_container_of(device, struct pico_pwm, pwm_device);
171 struct rt_pwm_configuration *configuration = (struct rt_pwm_configuration *)arg;
172
173 switch (cmd)
174 {
175 case PWM_CMD_ENABLE:
176 pwm_set_enabled (_pwm->slice_num, RT_TRUE);
177 return RT_EOK;
178 case PWM_CMD_DISABLE:
179 pwm_set_enabled (_pwm->slice_num, RT_FALSE);
180 return RT_EOK;
181 case PWM_CMD_SET:
182 return _pwm_set(_pwm->slice_num, configuration);
183 case PWM_CMD_GET:
184 return _pwm_get(_pwm->slice_num, configuration);
185 default:
186 return -RT_EINVAL;
187 }
188}
189
190static struct rt_pwm_ops _pwm_ops =
191{

Callers

nothing calls this directly

Calls 2

_pwm_setFunction · 0.70
_pwm_getFunction · 0.70

Tested by

no test coverage detected