/* ATtiny85 USI UART v2 David Johnson-Davies - www.technoblogy.com - 3rd May 2015 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/ */ // Constants const int DataIn = 0; 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) { pinMode(DataIn, INPUT); // Define DI as input USICR = 0; // Disable USI. GIFR = 1<