@ -614,6 +613,8 @@ int PWMOut::ioctl(file *filp, int cmd, unsigned long arg)
@@ -614,6 +613,8 @@ int PWMOut::ioctl(file *filp, int cmd, unsigned long arg)
returnret;
}
#endif // BOARD_HAS_CAPTURE
/* if we are in valid PWM mode, try it as a PWM ioctl as well */
switch(_mode){
caseMODE_1PWM:
@ -621,11 +622,14 @@ int PWMOut::ioctl(file *filp, int cmd, unsigned long arg)
@@ -621,11 +622,14 @@ int PWMOut::ioctl(file *filp, int cmd, unsigned long arg)
caseMODE_3PWM:
caseMODE_4PWM:
caseMODE_5PWM:
#if defined(BOARD_HAS_CAPTURE)
caseMODE_2PWM2CAP:
caseMODE_3PWM1CAP:
caseMODE_4PWM1CAP:
caseMODE_4PWM2CAP:
caseMODE_5PWM1CAP:
#endif // BOARD_HAS_CAPTURE
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 6
caseMODE_6PWM:
#endif
@ -651,7 +655,7 @@ int PWMOut::ioctl(file *filp, int cmd, unsigned long arg)
@@ -651,7 +655,7 @@ int PWMOut::ioctl(file *filp, int cmd, unsigned long arg)
@ -927,6 +931,8 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -927,6 +931,8 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
casePWM_SERVO_SET(11):
casePWM_SERVO_SET(10):
casePWM_SERVO_SET(9):
// FALLTHROUGH
casePWM_SERVO_SET(8):
if(_mode<MODE_14PWM){
ret=-EINVAL;
@ -936,9 +942,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -936,9 +942,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
#endif
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 8
// FALLTHROUGH
casePWM_SERVO_SET(7):
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_SET(6):
if(_mode<MODE_8PWM){
ret=-EINVAL;
@ -949,7 +956,7 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -949,7 +956,7 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 6
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_SET(5):
if(_mode<MODE_6PWM){
ret=-EINVAL;
@ -959,7 +966,7 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -959,7 +966,7 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
#endif
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 5
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_SET(4):
if(_mode<MODE_5PWM){
ret=-EINVAL;
@ -968,21 +975,21 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -968,21 +975,21 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
#endif
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_SET(3):
if(_mode<MODE_4PWM){
ret=-EINVAL;
break;
}
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_SET(2):
if(_mode<MODE_3PWM){
ret=-EINVAL;
break;
}
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_SET(1):
casePWM_SERVO_SET(0):
if(arg<=2100){
@ -1008,9 +1015,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -1008,9 +1015,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
}
#endif
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 8
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_GET(7):
casePWM_SERVO_GET(6):
if(_mode<MODE_8PWM){
@ -1022,7 +1030,7 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -1022,7 +1030,7 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 6
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_GET(5):
if(_mode<MODE_6PWM){
ret=-EINVAL;
@ -1030,9 +1038,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -1030,9 +1038,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
}
#endif
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 5
/* FALLTHROUGH */
// FALLTHROUGH
casePWM_SERVO_GET(4):
if(_mode<MODE_5PWM){
ret=-EINVAL;
@ -1041,21 +1050,21 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -1041,21 +1050,21 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@ -1300,29 +1309,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@@ -1300,29 +1309,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg)
@ -1463,11 +1453,9 @@ int PWMOut::capture_ioctl(struct file *filp, int cmd, unsigned long arg)
@@ -1463,11 +1453,9 @@ int PWMOut::capture_ioctl(struct file *filp, int cmd, unsigned long arg)
unlock();
#else
ret=-ENOTTY;
#endif
returnret;
}
#endif // BOARD_HAS_CAPTURE
intPWMOut::fmu_new_mode(PortModenew_mode)
{
@ -1475,9 +1463,7 @@ int PWMOut::fmu_new_mode(PortMode new_mode)
@@ -1475,9 +1463,7 @@ int PWMOut::fmu_new_mode(PortMode new_mode)
return-1;
}
PWMOut::Modeservo_mode;
servo_mode=PWMOut::MODE_NONE;
PWMOut::Modeservo_mode=PWMOut::MODE_NONE;
switch(new_mode){
casePORT_FULL_GPIO:
@ -1600,17 +1586,7 @@ int PWMOut::fmu_new_mode(PortMode new_mode)
@@ -1600,17 +1586,7 @@ int PWMOut::fmu_new_mode(PortMode new_mode)