1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 21:35:44 +03:00

Multishot Implementation

This commit is contained in:
borisbstyle 2016-02-23 04:15:12 +01:00
parent 6b8f4f1111
commit ee76376005
6 changed files with 25 additions and 2 deletions

View file

@ -145,6 +145,11 @@ static void pwmWriteOneshot42(uint8_t index, uint16_t value)
*motors[index]->ccr = value;
}
static void pwmWriteMultiShot(uint8_t index, uint16_t value)
{
*motors[index]->ccr = (uint16_t)((float)(value-1000) / 4.1666f)+ 60;
}
void pwmWriteMotor(uint8_t index, uint16_t value)
{
if (motors[index] && index < MAX_MOTORS)
@ -221,6 +226,12 @@ void pwmOneshotMotorConfig(const timerHardware_t *timerHardware, uint8_t motorIn
}
}
void pwmMultiShotMotorConfig(const timerHardware_t *timerHardware, uint8_t motorIndex)
{
motors[motorIndex] = pwmOutConfig(timerHardware, MULTISHOT_TIMER_MHZ, 0xFFFF, 0);
motors[motorIndex]->pwmWritePtr = pwmWriteMultiShot;
}
#ifdef USE_SERVOS
void pwmServoConfig(const timerHardware_t *timerHardware, uint8_t servoIndex, uint16_t servoPwmRate, uint16_t servoCenterPulse)
{