1
0
mirror of synced 2024-06-10 01:09:51 +02:00
avr_demo/tpic6b595_spi/spi.h

26 lines
712 B
C
Raw Normal View History

2011-11-20 18:11:58 +01:00
/*
* spi.h
*
* Copyright 2011 Mika Tuupola
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
*/
#define SPI_SS 10 /* Slave select. PORTB2 LATCH */
#define SPI_MOSI 11 /* Master out slave input. PORTB3 DATA*/
#define SPI_MISO 12 /* Master input slave output. PORTB4 */
#define SPI_SCK 13 /* Serial clock. PORTB5 CLOCK */
#define spi_set_lsb() SPCR |= _BV(DORD)
#define spi_set_msb() SPCR &= ~(_BV(DORD))
#define spi_set_master() SPCR |= _BV(MSTR)
#define spi_set_slave() SPCR &= ~(_BV(MSTR))
#define spi_enable() SPCR |= _BV(SPE)
#define spi_disable() SPCR &= ~(_BV(SPE));
uint8_t spi_transfer(volatile uint8_t data);
void spi_init(void);