resources/libtiny/Servo.cpp
//=============================================================================
// FUNCTION:    void enableDisableServo(uint8_t servoNumber, bool servoShouldBeEnabled)
//
// DESCRIPTION: Enabled or disables an allocated servo slot.
//              An enabled slot generates a pwm wave on its pin.
//              A disabled slot does not.
//
// INPUT:       servoNumber - which servo slot to update
//              servoShouldBeEnabled - true to enable the servo slot
//                                     false to disable the servo slot
//
// RETURNS:     Nothing
//
//=============================================================================
void enableDisableServo(uint8_t servoNumber, bool servoShouldBeEnabled)
DESCRIPTION: Enabled or disables an allocated servo slot.
An enabled slot generates a pwm wave on its pin.
A disabled slot does not.

which servo slot to update
servoShouldBeEnabled - true to enable the servo slot
false to disable the servo slot

Nothing
void enableDisableServo ( uint8_t servoNumber bool servoShouldBeEnabled ) DESCRIPTION : Enabled or disables an allocated servo slot . An enabled slot generates a pwm wave on its pin . A disabled slot does not . which servo slot to update servoShouldBeEnabled - true to enable the servo slot false to disable the servo slot Nothing
void ServoSequencer::enableDisableServo(uint8_t servoNumber, bool servoShouldBeEnabled)
{
    if( (servoNumber < MAX_SERVOS      ) &&
        (servoRegistry[servoNumber].slotOccupied == true)   )
    {
        if(servoShouldBeEnabled == true)
        {
            if( timerIsSetup == false)
            {
                servoTimerSetup();
                timerIsSetup = true;
            }
            else
            {
            }
            servoRegistry[servoNumber].enabled = true;
        }
        else
        {
            servoRegistry[servoNumber].enabled = false;
        }
    }
    else
    {
    }
}
void ServoSequencer :: enableDisableServo ( uint8_t servoNumber , bool servoShouldBeEnabled ) { if ( ( servoNumber < MAX_SERVOS ) && ( servoRegistry [ servoNumber ] . slotOccupied == true ) ) { if ( servoShouldBeEnabled == true ) { if ( timerIsSetup == false ) { servoTimerSetup ( ) ; timerIsSetup = true ; } else { } servoRegistry [ servoNumber ] . enabled = true ; } else { servoRegistry [ servoNumber ] . enabled = false ; } } else { } }
FUNCTION:    void enableDisableServo(uint8_t servoNumber, bool servoShouldBeEnabled)
DESCRIPTION: Enabled or disables an allocated servo slot.
FUNCTION : void enableDisableServo ( uint8_t servoNumber bool servoShouldBeEnabled ) DESCRIPTION : Enabled or disables an allocated servo slot .
//make sure we got a valid slot number and the slot is registered to a servo //if this is the very first servo we are enabling then configure the servo timer //The timer is already setup. Do nothing. //It needs to be setup only once. We do it when the first servo is enabled. //We setup the timer as late as possible. This allows this servo library //to be more compatible with various frameworks written for the attiny45/85, //which typically configure all the timers to their liking on start up. //Configuring our timer late allows us to overwrite these settings. //enable the servo. Its pulse will now be outputed on its pin. //disable the servo. Its pulse will cease to be generated. //TODO: set this servo pin low, if it is high. //      Actually, ideally the pulse should finish by itself //      forcing the pin low will generate a weird length pulse for the servo //      Need to add some sort of "disable pending" status //Servo number is out of range or is not allocate to a servo. Do nothing.