Mode: SPI_MODE0 or SPI_MODE1 (modes 2 and 3 are not supported) Returns See the Wikipedia article on SPI for details. Syntaxĭisables the SPI bus (leaving the pin modes unchanged). Initializes the SPI bus, sets the USCK and DO pins to outputs, sets the DI pin to input. TinySPI has been tested with Arduino 1.8.5 and the ATTiny Core. Included with the library are example sketches that demonstrate driving a 74HC595 shift register from an ATtiny84 and from an ATtiny85. Interrupts are inhibited during each byte transfer to ensure a consistent bit clock period. For example, given a 1MHz system clock, the SPI clock will be about 100kHz, and it will take about 80μs to transfer one byte.
TinySPI will generate an SPI bit clock that is about one-tenth the MCU system clock frequency.
ARDUINO 1.8.5 ATTINY SOFTWARE
Supported MCUs include ATtiny24/44/84, 25/45/85, 261/461/861, 2313/4313.īecause the USI hardware is not as sophisticated as the dedicated SPI hardware in the ATmega MCUs, tinySPI is more limited than the standard Arduino SPI library but still has several advantages over software bit-bang approaches.Īs compared to the Arduino shiftOut() function, tinySPI TinySPI is an Arduino SPI master library for ATtiny microcontrollers that utilizes the USI hardware in the ATtiny MCUs. You should have received a copy of the GNU General Public LicenseĪlong with this program. See the GNU General Public License for more details. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3.0 as published by the Free Software Foundation. Arduino tinySPI Library Copyright (C) 2018 Jack Christensen GNU GPL v3.0