Forked library from okini3939/at45db161d
Fork of at45db161d by
Revision 2:111e8cf6f263, committed 2015-09-19
- Comitter:
- k4zuki
- Date:
- Sat Sep 19 10:15:44 2015 +0000
- Parent:
- 1:b379e16fdf6f
- Child:
- 3:c2cd805585ef
- Commit message:
- Use SWSPI instead of SPI
Changed in this revision
at45db161d.cpp | Show annotated file Show diff for this revision Revisions of this file |
at45db161d.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/at45db161d.cpp Thu Sep 15 15:09:56 2011 +0000 +++ b/at45db161d.cpp Sat Sep 19 10:15:44 2015 +0000 @@ -15,7 +15,7 @@ : _spi(mosi, miso, sclk), _cs(cs) {} -ATD45DB161D::ATD45DB161D(SPI &spi, PinName cs) +ATD45DB161D::ATD45DB161D(SWSPI &spi, PinName cs) : _spi(spi), _cs(cs) {} @@ -26,26 +26,12 @@ /** Setup SPI and pinout **/ void ATD45DB161D::Init() { -// uint8_t clr; - - /* Initialize pinout */ -/* - pinMode(DATAOUT, OUTPUT); - pinMode(DATAIN, INPUT); - pinMode(SPICLOCK, OUTPUT); - pinMode(SLAVESELECT, OUTPUT); - pinMode(DATAIN, INPUT); -*/ - /* Disable device */ - DF_CS_inactive; + /* Disable device */ + DF_CS_inactive; /* Setup SPI */ -// SPCR = (1 << SPE) | (1 << MSTR) | (1 << CPOL) | (1 << CPHA); _spi.format(8, 0); - /* Cleanup registers */ -// clr = SPSR; -// clr = SPDR; } /**
--- a/at45db161d.h Thu Sep 15 15:09:56 2011 +0000 +++ b/at45db161d.h Sat Sep 19 10:15:44 2015 +0000 @@ -16,6 +16,7 @@ }; #include "at45db161d_commands.h" +#include "SWSPI.h" /** * @defgroup AT45DB161D AT45DB161D module @@ -51,7 +52,7 @@ * @fn inline uint8_t spi_transfer(uint8_t data) * @brief Transfer a byte via spi * @param data Data to transfer via SPI - * @return The content of the SPI data register (SPDR) + * @return The content of the SPI data register **/ /* inline uint8_t spi_transfer(uint8_t data) @@ -80,7 +81,7 @@ * @{ **/ /** - * Ready/busy status is indicated using bit 7 of the status register. + * @brief Ready/busy status is indicated using bit 7 of the status register. * If bit 7 is a 1, then the device is not busy and is ready to accept * the next command. If bit 7 is a 0, then the device is in a busy * state. @@ -146,7 +147,7 @@ public: /** CTOR **/ ATD45DB161D(PinName mosi, PinName miso, PinName sclk, PinName cs); - ATD45DB161D(SPI &spi, PinName cs); + ATD45DB161D(SWSPI &spi, PinName cs); /** DTOR **/ ~ATD45DB161D(); @@ -297,7 +298,7 @@ private: /* Nothing atm but who knows... */ - SPI _spi; + SWSPI _spi; DigitalOut _cs; };