summaryrefslogtreecommitdiffhomepage
path: root/digital/avr/modules
diff options
context:
space:
mode:
Diffstat (limited to 'digital/avr/modules')
-rw-r--r--digital/avr/modules/spi/spi.c12
-rw-r--r--digital/avr/modules/spi/spi.h7
2 files changed, 19 insertions, 0 deletions
diff --git a/digital/avr/modules/spi/spi.c b/digital/avr/modules/spi/spi.c
index 1098b260..8fb35bb9 100644
--- a/digital/avr/modules/spi/spi.c
+++ b/digital/avr/modules/spi/spi.c
@@ -91,6 +91,18 @@ spi_recv(void)
return SPDR;
}
+/** Receive a date from the SPI bus from the address provided by parameters.
+ * \param addr the address from which the data shall be read
+ * \return the data at the address requested.
+ */
+uint8_t
+spi_recv_from (uint8_t addr)
+{
+ SPDR = addr;
+
+ return spi_recv();
+}
+
/** Return the status register from the SPI driver.
* \return the status register value
*/
diff --git a/digital/avr/modules/spi/spi.h b/digital/avr/modules/spi/spi.h
index f8771326..59e09fc7 100644
--- a/digital/avr/modules/spi/spi.h
+++ b/digital/avr/modules/spi/spi.h
@@ -91,6 +91,13 @@ spi_send(uint8_t *data, uint8_t length);
uint8_t
spi_recv(void);
+/** Receive a date from the SPI bus from the address provided by parameters.
+ * \param addr the address from which the data shall be read
+ * \return the data at the address requested.
+ */
+uint8_t
+spi_recv_from (uint8_t addr);
+
/** Return the status register from the SPI driver.
* \return the status register value
*/