Raw Text Content QR
emu-tiger-emu



void TWI_start(){
    TWCR = (1 << TWEN) | (1 << TWSTA) | (1 << TWINT);
    while (!(TWCR & (1 << TWINT)));
    PORTB = TWSR;   // <-- zmieniamy PORTD → PORTB
    _delay_ms(200);
}

void TWI_address_transmit(){
    TWDR = 0b01001000; // Write address
    TWCR = (1 << TWEN) | (1 << TWINT);
    while (!(TWCR & (1 << TWINT)));
    PORTB = TWSR;   // <-- zmieniamy PORTD → PORTB
    _delay_ms(200);
}

void TWI_address_receive(){
    TWDR = 0b01001001; // Read address
    TWCR = (1 << TWEN) | (1 << TWINT);
    while (!(TWCR & (1 << TWINT)));
    PORTB = TWSR;   // <-- zmieniamy PORTD → PORTB
    _delay_ms(200);
}

void TWI_stop(){
    TWCR = (1 << TWEN) | (1 << TWSTO);
    _delay_ms(200);
    PORTB = TWSR;   // <-- zmieniamy PORTD → PORTB
}

Read 6 times, last 77 seconds ago