mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 07:53:33 +08:00
[PX4IO/PWM driver] Added trim values to the PWM output drivers
This commit is contained in:
committed by
Lorenz Meier
parent
4494182bfc
commit
619efa7b45
@@ -2688,6 +2688,30 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg)
|
||||
|
||||
break;
|
||||
|
||||
case PWM_SERVO_SET_TRIM_PWM: {
|
||||
struct pwm_output_values *pwm = (struct pwm_output_values *)arg;
|
||||
|
||||
if (pwm->channel_count > _max_actuators)
|
||||
/* fail with error */
|
||||
{
|
||||
return -E2BIG;
|
||||
}
|
||||
|
||||
/* copy values to registers in IO */
|
||||
ret = io_reg_set(PX4IO_PAGE_CONTROL_TRIM_PWM, 0, pwm->values, pwm->channel_count);
|
||||
break;
|
||||
}
|
||||
|
||||
case PWM_SERVO_GET_TRIM_PWM:
|
||||
|
||||
ret = io_reg_get(PX4IO_PAGE_CONTROL_TRIM_PWM, 0, (uint16_t *)arg, _max_actuators);
|
||||
|
||||
if (ret != OK) {
|
||||
ret = -EIO;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PWM_SERVO_GET_COUNT:
|
||||
*(unsigned *)arg = _max_actuators;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user