resources/libtiny/Servo.cpp
//=============================================================================
// FUNCTION:    bool registerServo()
//
// DESCRIPTION: Reserves a slot for a servo in the pulse sequence.
//              There is a limited number of slots.
//
// INPUT:       Nothing
//
// RETURNS:     On success returns the slot number.
//              If no free slot is found returns INVALID_SERVO.
//=============================================================================
bool registerServo()
DESCRIPTION: Reserves a slot for a servo in the pulse sequence.
There is a limited number of slots.

Nothing

On success returns the slot number.
If no free slot is found returns INVALID_SERVO.
bool registerServo () DESCRIPTION : Reserves a slot for a servo in the pulse sequence . There is a limited number of slots . Nothing On success returns the slot number . If no free slot is found returns INVALID_SERVO .
uint8_t ServoSequencer::registerServo()
{
    if(servoArrayIsInited == false)
    {
        initServoArray();
    }
    else
    {
    }
    for(uint8_t i = 0; i < MAX_SERVOS; i++)
    {
        if(servoRegistry[i].slotOccupied == false)
        {
            servoRegistry[i].slotOccupied = true;
            return i;
        }
        else
        {
        }
    }
    return INVALID_SERVO;
}
uint8_t ServoSequencer :: registerServo ( ) { if ( servoArrayIsInited == false ) { initServoArray ( ) ; } else { } for ( uint8_t i = 0 ; i < MAX_SERVOS ; i ++ ) { if ( servoRegistry [ i ] . slotOccupied == false ) { servoRegistry [ i ] . slotOccupied = true ; return i ; } else { } } return INVALID_SERVO ; }
FUNCTION:    bool registerServo()
DESCRIPTION: Reserves a slot for a servo in the pulse sequence.
FUNCTION : bool registerServo () DESCRIPTION : Reserves a slot for a servo in the pulse sequence .
//the servo array is already inited. Do nothing. //It needs to be setup only once. We do it when the first servo is registered. //find a free slot in the servo registry //found a free slot. //return the slot number //this slot is not free, check the next one. //no free slots were found.