Merge pull request #1460 from blckmn/assign_any

Allow any allocation for motors and servos
This commit is contained in:
Martin Budden 2016-11-05 09:18:49 +01:00 committed by GitHub
commit 504ac9c134
3 changed files with 4 additions and 3 deletions

View File

@ -208,7 +208,7 @@ void motorInit(const motorConfig_t *motorConfig, uint16_t idlePulse, uint8_t mot
break;
}
const timerHardware_t *timerHardware = timerGetByTag(tag, TIM_USE_MOTOR);
const timerHardware_t *timerHardware = timerGetByTag(tag, TIM_USE_ANY);
if (timerHardware == NULL) {
/* flag failure and disable ability to arm */
@ -271,7 +271,7 @@ void servoInit(const servoConfig_t *servoConfig)
IOInit(servos[servoIndex].io, OWNER_SERVO, RESOURCE_OUTPUT, RESOURCE_INDEX(servoIndex));
IOConfigGPIO(servos[servoIndex].io, IOCFG_AF_PP);
const timerHardware_t *timer = timerGetByTag(tag, TIM_USE_SERVO);
const timerHardware_t *timer = timerGetByTag(tag, TIM_USE_ANY);
if (timer == NULL) {
/* flag failure and disable ability to arm */

View File

@ -759,7 +759,7 @@ const timerHardware_t *timerGetByTag(ioTag_t tag, timerUsageFlag_e flag)
{
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT; i++) {
if (timerHardware[i].tag == tag) {
if (timerHardware[i].usageFlags & flag) {
if (timerHardware[i].usageFlags & flag || flag == 0) {
return &timerHardware[i];
}
}

View File

@ -55,6 +55,7 @@ typedef uint32_t timCNT_t;
#endif
typedef enum {
TIM_USE_ANY = 0x0,
TIM_USE_PPM = 0x1,
TIM_USE_PWM = 0x2,
TIM_USE_MOTOR = 0x4,