diff options
author | Karel Kočí <cynerd@email.cz> | 2015-03-22 14:05:00 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-03-22 14:05:00 +0100 |
commit | a5bb06281011f4f0edd6f7b9331f149bd256d495 (patch) | |
tree | 7b576d3b3a737e94a601a236523612369152f52b /src/avr25/spi_usi.c | |
parent | 9447247c1ab0b0a02c5ec87c138135953986975c (diff) | |
download | avr-ioe-a5bb06281011f4f0edd6f7b9331f149bd256d495.tar.gz avr-ioe-a5bb06281011f4f0edd6f7b9331f149bd256d495.tar.bz2 avr-ioe-a5bb06281011f4f0edd6f7b9331f149bd256d495.zip |
SPI moved from src subfolder and mode changes
SPI USI should now work.
SPI USI is now documented.
Removing architecture specific folders in src.
Diffstat (limited to 'src/avr25/spi_usi.c')
-rw-r--r-- | src/avr25/spi_usi.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/avr25/spi_usi.c b/src/avr25/spi_usi.c deleted file mode 100644 index e63721a..0000000 --- a/src/avr25/spi_usi.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "../../spi_usi.h" - -#if __AVR_ARCH__ == 25 - -#ifdef IOE_SPI_USI_MASTER - -// TODO counter settings with interups -inline void ioe_spi_usi_init(void) { - USI_DIR_REG |= _BV(USI_USCK_PIN) | _BV(USI_DO_PIN); - USI_OUT_REG |= _BV(USI_DI_PIN); - - USICR |= _BV(USIWM0) | _BV(USICS1) | _BV(USICLK); -} - -inline int8_t ioe_spi_usi_transfer(int8_t d) { - USISR |= _BV(USIOIF); - USIDR = d; - do { - USICR |= _BV(USITC); - } while (!(USISR & _BV(USIOIF))); - return USIDR; -} - -#else /* IOE_SPI_USI_MASTER */ - -inline void ioe_spi_usi_init(void) { - USI_DIR_REG |= _BV(USI_DO_PIN); - USI_OUT_REG |= _BV(USI_USCK_PIN) | _BV(USI_DI_PIN); - - USICR |= _BV(USIWM0) | _BV(USICS1) | _BV(USIOIE); -} - -inline void ioe_spi_usi_expose(int8_t data) { - USIDR = data; -} - -inline void ioe_spi_usi_expect(void) { - USISR |= _BV(USIOIF); -} - -inline int ioe_spi_usi_busy(void) { - return USISR & 0x0F; -} - -inline void ioe_spi_usi_join(void) { - while (ioe_spi_usi_busy()) { - } -} - -SIGNAL(USI_OVF_vect) { - ioe_spi_usi_retrieve(USIDR); -} - -#endif /* IOE_SPI_USI_MASTER */ - -#endif /* __AVR_ARCH__ == 25 */ |