int main() { LED_OUTPUT(); usi_init_master(); volatile TWRESULT status = usi_start_master(0x08, 1); if (status != TWST_OK) { while(1) { LED_TOGGLE(); _delay_ms(100); } } LED_HIGH(); for (uint8_t i = 0; i < 25; ++i) { volatile uint8_t data = usi_read_master(0); } usi_read_master(1); usi_stop(); LED_LOW(); while(1); return 0; }
//-------------------------------------------------------------------------------------------- // set led on off int LEDSet(int st) { led_state = st; if (st) LED_HIGH(); else LED_LOW(); return 1; }