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 /spi_usi.h | |
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 'spi_usi.h')
-rw-r--r-- | spi_usi.h | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -3,21 +3,44 @@ #include <avr/interrupt.h> #include <inttypes.h> -#include "mcu/mcu.h" - #ifndef _IOE_SPI_USI_H_ #define _IOE_SPI_USI_H_ +/* + * Initialize USI as SPI + * + * NOTE: Global interrupt must be enabled for right function. + * { SREG |= _BV(7) } + */ inline void ioe_spi_usi_init(void); #ifdef IOE_SPI_USI_MASTER +/* + * Swaps byte with slave over SPI. + */ inline int8_t ioe_spi_usi_transfer(int8_t data); #else +/* + * Expose data for next master request. + * Please don't use this when device is busy. + * Best place to call this is ioe_spi_usi_retrieve(). + */ inline void ioe_spi_usi_expose(int8_t data); -inline void ioe_spi_usi_expect(void); -inline int ioe_spi_usi_ready(void); +/* + * Returns NULL when device is no busy. + * When device is busy, returned value is number of already send bits. + */ +inline uint8_t ioe_spi_usi_busy(void); +/* + * Blocks processor until device is not busy. + */ inline void ioe_spi_usi_join(void); // Following function must be user defined +/* + * This function must be defined by user. + * This function is called every time transfer is finished. + * And until return from this function interrupts are disabled. + */ inline void ioe_spi_usi_retrieve(int8_t data); #endif /* IOE_SPI_USI_MASTER */ |