From bab75a6068ab0a64fe22395ad11efafccbf0d842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 11 Oct 2015 13:06:28 +0200 Subject: Implement SPI and remove files --- examples/spiblink/slave.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/spiblink/slave.c (limited to 'examples/spiblink/slave.c') diff --git a/examples/spiblink/slave.c b/examples/spiblink/slave.c new file mode 100644 index 0000000..cf14408 --- /dev/null +++ b/examples/spiblink/slave.c @@ -0,0 +1,21 @@ +#include +#include +#include "../../spi.h" + +void receive(uint8_t data); + +int main() { + DDRB |= _BV(DDB1); + spi_receive = receive; + spi_init(SPI_MODE_SLAVE); + SREG |= _BV(7); + while (1) { + } +} + +void receive(uint8_t data) { + if (data) + PORTB |= _BV(PORTB1); + else + PORTB &= ~_BV(PORTB1); +} -- cgit v1.2.3