aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
diff options
context:
space:
mode:
authorPerry Hung <iperry@alum.mit.edu>2010-04-28 19:19:34 -0400
committerPerry Hung <iperry@alum.mit.edu>2010-04-28 19:19:34 -0400
commita7031b147c9ee77d1ed04ec419a7a23edd08014a (patch)
treecebd5e51dfba2c0af4d47156e909fb190af77069 /wirish
parent28feb18a8f6d3dd2d0d78a40d4213407fb54e5dd (diff)
downloadlibrambutan-a7031b147c9ee77d1ed04ec419a7a23edd08014a.tar.gz
librambutan-a7031b147c9ee77d1ed04ec419a7a23edd08014a.zip
Various SPI changes.
-Read DR after each master send, return the response. -Added a send function to allow you to pass buffers to the SPI peripheral instead of goin a byte at a time.
Diffstat (limited to 'wirish')
-rw-r--r--wirish/comm/HardwareSPI.cpp8
-rw-r--r--wirish/comm/HardwareSPI.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/wirish/comm/HardwareSPI.cpp b/wirish/comm/HardwareSPI.cpp
index 4379a0d..3dfe10a 100644
--- a/wirish/comm/HardwareSPI.cpp
+++ b/wirish/comm/HardwareSPI.cpp
@@ -118,12 +118,12 @@ void HardwareSPI::begin(void) {
* @brief send a byte out the spi peripheral
* @param data byte to send
*/
-void HardwareSPI::send(uint8 data) {
- spi_tx_byte(this->spi_num, data);
+uint8 HardwareSPI::send(uint8 data) {
+ return spi_tx_byte(this->spi_num, data);
}
-void HardwareSPI::send(uint8 *buf, uint32 len) {
- spi_tx(this->spi_num, buf, len);
+uint8 HardwareSPI::send(uint8 *buf, uint32 len) {
+ return spi_tx(this->spi_num, buf, len);
}
diff --git a/wirish/comm/HardwareSPI.h b/wirish/comm/HardwareSPI.h
index 04d67ba..e606c0c 100644
--- a/wirish/comm/HardwareSPI.h
+++ b/wirish/comm/HardwareSPI.h
@@ -49,8 +49,8 @@ class HardwareSPI {
HardwareSPI(uint32 spi_num);
void begin(void);
void begin(SPIFrequency freq, uint32 endianness, uint32 mode);
- void send(uint8 data);
- void send(uint8 *data, uint32 length);
+ uint8 send(uint8 data);
+ uint8 send(uint8 *data, uint32 length);
uint8 recv(void);
};