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

int main() {
	io_setin(CONFIG_BUTTON_IO, IO_PULLUP);
	io_setout(CONFIG_LED_IO);

	spi_init(SPI_MODE_MASTER);
	// SREG |= _BV(7); // Enable interrupts TODO I don't think that we need this

	while (1) {
		io_set(CONFIG_LED_IO, io_get(CONFIG_BUTTON_IO));
		spi_send(io_get(CONFIG_BUTTON_IO));
	}
}