diff options
Diffstat (limited to 'examples/spiblink/slave')
-rw-r--r-- | examples/spiblink/slave/.config | 44 | ||||
-rw-r--r-- | examples/spiblink/slave/Kconfig | 15 | ||||
-rw-r--r-- | examples/spiblink/slave/Makefile | 6 | ||||
-rw-r--r-- | examples/spiblink/slave/slave.c | 19 |
4 files changed, 84 insertions, 0 deletions
diff --git a/examples/spiblink/slave/.config b/examples/spiblink/slave/.config new file mode 100644 index 0000000..31c10ea --- /dev/null +++ b/examples/spiblink/slave/.config @@ -0,0 +1,44 @@ +# +# Automatically generated file; DO NOT EDIT. +# AVR-IOE spiblink slave configuration +# +SPIBLINK_SLAVE_DEFAULTS=y +CONFIG_BLINK_IO="IO_B0" +MMCU="atmega328p" +ATMEGA328P=y +# ATMEGA168A is not set +# ATTINY85 is not set +# ATTINY4313 is not set +F_CPU=16000 + +# +# Compilation options +# +CHOST="avr-" +CCFLAGS="-Os -ffunction-sections -fdata-sections -fshort-enums -Wall" +CLDFLAGS="" +CBUILD="" +BUILD_CFLAGS="-Wall" +BUILD_LDFLAGS="" +CONFIG_ERRORS=y + +# +# Errors handling +# +# CONFIG_EH_RESTART is not set +# CONFIG_EH_HANG is not set +# CONFIG_EH_LED is not set +# CONFIG_ERROR_MESSAGES is not set +# CONFIG_ERROR_CALLBACK is not set +# CONFIG_CHECK_ARGUMENTS is not set +MCUSUPPORT_IOPORTS=y +CONFIG_IOPORTS=y +MCUSUPPORT_PCINT0=y +MCUSUPPORT_PCINT1=y +MCUSUPPORT_PCINT2=y +# CONFIG_IOPORTS_PCINT is not set +MCUSUPPORT_SPI=y +CONFIG_SPI=y +MCUSUPPORT_USART=y +# CONFIG_USART is not set +# CONFIG_TIMERS is not set diff --git a/examples/spiblink/slave/Kconfig b/examples/spiblink/slave/Kconfig new file mode 100644 index 0000000..c264b9f --- /dev/null +++ b/examples/spiblink/slave/Kconfig @@ -0,0 +1,15 @@ +mainmenu "AVR-IOE spiblink slave configuration" + +# We need CONFIG_IOPORTS, but we don't care about anything else. +config SPIBLINK_SLAVE_DEFAULTS + bool + default y + select CONFIG_SPI + select CONFIG_IOPORTS + +config CONFIG_BLINK_IO + string "Output pin used to connect led" + depends on SPIBLINK_SLAVE_DEFAULTS + default "IO_B0" + +source "../../../ioe.Kconfig" diff --git a/examples/spiblink/slave/Makefile b/examples/spiblink/slave/Makefile new file mode 100644 index 0000000..7410058 --- /dev/null +++ b/examples/spiblink/slave/Makefile @@ -0,0 +1,6 @@ +EXAMPLE_NAME = spiblink_slave +EXAMPLE_PATH = spiblink/slave +SRC = slave.c + +IOEROOT=../../../ +include ../../examples.mk diff --git a/examples/spiblink/slave/slave.c b/examples/spiblink/slave/slave.c new file mode 100644 index 0000000..2a65323 --- /dev/null +++ b/examples/spiblink/slave/slave.c @@ -0,0 +1,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); +} |