aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-10-17 15:40:51 +0200
committerKarel Kočí <cynerd@email.cz>2015-10-17 15:40:51 +0200
commitb0d8f22f3492fbb3f6dc0e8026e63c803af59007 (patch)
treeeb9707612e87856962474885f2a18ae1621d214e /doc
parent8fa9db4244f4ee33aa47561c569edfa62fe37928 (diff)
downloadavr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.tar.gz
avr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.tar.bz2
avr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.zip
Complete commit of current work
Diffstat (limited to 'doc')
-rw-r--r--doc/spi.html13
-rw-r--r--doc/spi.md60
2 files changed, 73 insertions, 0 deletions
diff --git a/doc/spi.html b/doc/spi.html
new file mode 100644
index 0000000..e81637f
--- /dev/null
+++ b/doc/spi.html
@@ -0,0 +1,13 @@
+<h2>Serial peripheral interface</h2>
+
+<h3>spi_init</h3>
+
+<pre><code class="c">static inline void spi_init(enum spiMode mode)
+</code></pre>
+
+<p>Initializes SPI interface.
+Parameters:
+ mode - Specify mode of SPI interface</p>
+
+<p> NOTE: Global interrupt must be enabled for right function of SPI.
+ { SREG |= _BV(7) }</p>
diff --git a/doc/spi.md b/doc/spi.md
new file mode 100644
index 0000000..3237882
--- /dev/null
+++ b/doc/spi.md
@@ -0,0 +1,60 @@
+Serial peripheral interface
+---------------------------
+
+## Functions
+### spi_init
+```C
+static inline void spi_init(enum spiMode mode)
+```
+Initializes SPI interface.
+Parameters:
+ mode - Specify mode of SPI interface
+
+NOTE: Global interrupt must be enabled for right function of SPI.
+ { SREG |= _BV(7) }
+
+### spi_busy
+```C
+static inline int8_t spi_busy(void)
+```
+Returns NULL when device is not busy.
+When device is busy return values in non-zero.
+
+### spi_join
+```C
+static inline void spi_join(void)
+```
+Blocks processor until device is not busy.
+
+### spi_send
+```C
+static inline uint8_t spi_send(uint8_t data)
+```
+Swap bytes with slave over SPI.
+This function blocks execution until device isn't busy (transfer completed).
+WARNING: Invoke this only when interface is initialized in MASTER mode.
+
+### spi_transfer
+```C
+static inline void spi_transfer(uint8_t data)
+```
+Transfer byte to slave over SPI.
+This function isn't blocking execution until transfer is complete.
+Always call spi_join before this function when called outside of spi_receive().
+WARNING: Invoke this only when interface is initialized in MASTER mode.
+
+### spi_expose
+```C
+static inline void spi_expose(uint8_t data)
+```
+Expose data for next master request.
+Please don't use this when device is busy.
+Best place to call this is spi_receive().
+WARNING: Invoke this only when interface is initialized in SLAVE mode.
+
+## Function pointer spi_receive
+```C
+extern void (*spi_receive)(uint8_t data)
+```
+This function is called every time transfer is finished.
+And until return from this function interrupts are disabled.