summaryrefslogtreecommitdiffhomepage
path: root/digital/ucoolib/ucoolib/hal/spi/spi_soft.hh
diff options
context:
space:
mode:
authorNicolas Schodet2013-02-24 23:43:23 +0100
committerNicolas Schodet2013-03-01 22:58:04 +0100
commit3a4bd5948939030b960c3363c04a33032d517fc7 (patch)
tree00fed9e08ae4640f0738f690e6ba735c62891802 /digital/ucoolib/ucoolib/hal/spi/spi_soft.hh
parent54848f43e39e38ca31cfa4e95b93baa60e1cb20b (diff)
digital/ucoolib/ucoolib: change setup to enable/disable
Diffstat (limited to 'digital/ucoolib/ucoolib/hal/spi/spi_soft.hh')
-rw-r--r--digital/ucoolib/ucoolib/hal/spi/spi_soft.hh14
1 files changed, 8 insertions, 6 deletions
diff --git a/digital/ucoolib/ucoolib/hal/spi/spi_soft.hh b/digital/ucoolib/ucoolib/hal/spi/spi_soft.hh
index dcf0441d..c9f7886a 100644
--- a/digital/ucoolib/ucoolib/hal/spi/spi_soft.hh
+++ b/digital/ucoolib/ucoolib/hal/spi/spi_soft.hh
@@ -32,13 +32,14 @@ namespace ucoo {
class SpiSoftMaster : public SpiMaster
{
public:
- /// Constructor, need all SPI pins. Speed is given in Hz.
- SpiSoftMaster (Io &sck, Io &mosi, Io &miso, int speed = 0,
- SpiMode mode = SPI_MODE_0);
- /// Destructor, release SPI pins.
+ /// Constructor, need all SPI pins.
+ SpiSoftMaster (Io &sck, Io &mosi, Io &miso);
+ /// Destructor, disable.
~SpiSoftMaster ();
- /// Change settings, use speed 0 to stop.
- void setup (int speed, SpiMode mode = SPI_MODE_0);
+ /// Enable and setup.
+ void enable (int speed_hz, SpiMode mode = SPI_MODE_0);
+ /// Disable.
+ void disable ();
/// See SpiMaster::send_and_recv.
void send_and_recv (const char *tx_buf, char *rx_buf, int count);
/// Send and receive one byte.
@@ -55,6 +56,7 @@ class SpiSoftMaster : public SpiMaster
Io &sck_, &mosi_, &miso_;
int half_period_ns_;
bool cpha_;
+ bool enabled_;
};
} // namespace ucoo