void TMR0_vWaitOneTOSC1(void)
{
    // Do "dummy" write to TCCR0 register for TOSC1 timed transfer
    TCCR0 = TMR0_TCCR0_VALUE;
    // Wait for "update busy" flag to clear
    LOOP_UNTIL_BIT_IS_LO(ASSR,TCR0UB);
}
Exemple #2
0
void twi_stop(void)
{
    // Wait for transaction to finish
    while(twi_busy())
    {
        ;
    }

    // Make sure transaction was succesful
    if(twi_status != TWI_STATUS_DONE)
    {
        return;
    }

    // Initiate a STOP condition
    TWCR = (1<<TWINT)|(0<<TWEA)|(0<<TWSTA)|(1<<TWSTO)|(0<<TWWC)|(1<<TWEN)|(0<<TWIE);

    // Wait until STOP has finished
    LOOP_UNTIL_BIT_IS_LO(TWCR, TWSTO);
}