mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
rcvr: Support PPM and PWM at the same time on CC
Adds a new mode for the receiver port (PPM+PWM) which will allow simultaneous use of 1 pin for PPM and the rest of the pins for PWM inputs.
This commit is contained in:
parent
4edf78d1cd
commit
2f4b1e69dd
@ -662,6 +662,33 @@ void PIOS_Board_Init(void) {
|
|||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_PPM */
|
#endif /* PIOS_INCLUDE_PPM */
|
||||||
break;
|
break;
|
||||||
|
case HWSETTINGS_CC_RCVRPORT_PPMPWM:
|
||||||
|
/* This is a combination of PPM and PWM inputs */
|
||||||
|
#if defined(PIOS_INCLUDE_PPM)
|
||||||
|
{
|
||||||
|
uint32_t pios_ppm_id;
|
||||||
|
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_cfg);
|
||||||
|
|
||||||
|
uint32_t pios_ppm_rcvr_id;
|
||||||
|
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id)) {
|
||||||
|
PIOS_Assert(0);
|
||||||
|
}
|
||||||
|
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PPM] = pios_ppm_rcvr_id;
|
||||||
|
}
|
||||||
|
#endif /* PIOS_INCLUDE_PPM */
|
||||||
|
#if defined(PIOS_INCLUDE_PWM)
|
||||||
|
{
|
||||||
|
uint32_t pios_pwm_id;
|
||||||
|
PIOS_PWM_Init(&pios_pwm_id, &pios_pwm_with_ppm_cfg);
|
||||||
|
|
||||||
|
uint32_t pios_pwm_rcvr_id;
|
||||||
|
if (PIOS_RCVR_Init(&pios_pwm_rcvr_id, &pios_pwm_rcvr_driver, pios_pwm_id)) {
|
||||||
|
PIOS_Assert(0);
|
||||||
|
}
|
||||||
|
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PWM] = pios_pwm_rcvr_id;
|
||||||
|
}
|
||||||
|
#endif /* PIOS_INCLUDE_PWM */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_GCSRCVR)
|
#if defined(PIOS_INCLUDE_GCSRCVR)
|
||||||
@ -683,6 +710,7 @@ void PIOS_Board_Init(void) {
|
|||||||
case HWSETTINGS_CC_RCVRPORT_DISABLED:
|
case HWSETTINGS_CC_RCVRPORT_DISABLED:
|
||||||
case HWSETTINGS_CC_RCVRPORT_PWM:
|
case HWSETTINGS_CC_RCVRPORT_PWM:
|
||||||
case HWSETTINGS_CC_RCVRPORT_PPM:
|
case HWSETTINGS_CC_RCVRPORT_PPM:
|
||||||
|
case HWSETTINGS_CC_RCVRPORT_PPMPWM:
|
||||||
PIOS_Servo_Init(&pios_servo_cfg);
|
PIOS_Servo_Init(&pios_servo_cfg);
|
||||||
break;
|
break;
|
||||||
case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTS:
|
case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTS:
|
||||||
|
@ -1134,6 +1134,19 @@ const struct pios_pwm_cfg pios_pwm_cfg = {
|
|||||||
.channels = pios_tim_rcvrport_all_channels,
|
.channels = pios_tim_rcvrport_all_channels,
|
||||||
.num_channels = NELEMENTS(pios_tim_rcvrport_all_channels),
|
.num_channels = NELEMENTS(pios_tim_rcvrport_all_channels),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const struct pios_pwm_cfg pios_pwm_with_ppm_cfg = {
|
||||||
|
.tim_ic_init = {
|
||||||
|
.TIM_ICPolarity = TIM_ICPolarity_Rising,
|
||||||
|
.TIM_ICSelection = TIM_ICSelection_DirectTI,
|
||||||
|
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
|
||||||
|
.TIM_ICFilter = 0x0,
|
||||||
|
},
|
||||||
|
/* Leave the first channel for PPM use and use the rest for PWM */
|
||||||
|
.channels = &pios_tim_rcvrport_all_channels[1],
|
||||||
|
.num_channels = NELEMENTS(pios_tim_rcvrport_all_channels) - 1,
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_I2C)
|
#if defined(PIOS_INCLUDE_I2C)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<xml>
|
<xml>
|
||||||
<object name="HwSettings" singleinstance="true" settings="true">
|
<object name="HwSettings" singleinstance="true" settings="true">
|
||||||
<description>Selection of optional hardware configurations.</description>
|
<description>Selection of optional hardware configurations.</description>
|
||||||
<field name="CC_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+Outputs,Outputs" defaultvalue="PWM"/>
|
<field name="CC_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+PWM,PPM+Outputs,Outputs" defaultvalue="PWM"/>
|
||||||
<field name="CC_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM2,DSMX (10bit),DSMX (11bit),ComAux,ComBridge" defaultvalue="Telemetry"/>
|
<field name="CC_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM2,DSMX (10bit),DSMX (11bit),ComAux,ComBridge" defaultvalue="Telemetry"/>
|
||||||
<field name="CC_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,DSM2,DSMX (10bit),DSMX (11bit),ComAux,ComBridge" defaultvalue="Disabled"/>
|
<field name="CC_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,DSM2,DSMX (10bit),DSMX (11bit),ComAux,ComBridge" defaultvalue="Disabled"/>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user