/* ATtiny85 USI UART v3 David Johnson-Davies - www.technoblogy.com - 6th May 2015 and Edgar Bonet - www.edgar-bonet.org ATtiny85 @ 8MHz (external crystal; BOD disabled) CC BY 4.0 Licensed under a Creative Commons Attribution 4.0 International license: http://creativecommons.org/licenses/by/4.0/ */ // Constant const int DataIn = PINB0; // USI DI // USI UART ********************************************** unsigned char ReverseByte (unsigned char x) { x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); return x; } // Initialise USI for UART reception. void InitialiseUSI (void) { DDRB &= ~(1<