aboutsummaryrefslogtreecommitdiff
path: root/examples/spiblink/slave/slave.c
blob: 2a653238a802d2f0141322d4e6c6137efd3df16e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <avr/io.h>
#include <util/delay.h>
#include <ioport.h>
#include <spi.h>

void receive(uint8_t data);

int main() {
	io_setout(CONFIG_BLINK_IO);

	spi_receive = receive;
	spi_init(SPI_MODE_SLAVE);
	SREG |= _BV(7); // Enable global interrupts
	while (1);  // Busy loop
}

void receive(uint8_t data) {
	io_set(CONFIG_BLINK_IO, data);
}