SPI driver for M25P* flash devices.

Dependents:   flash-fs-example Dragonfly_Filesystem_Example Dragonfly_Low_Power_Example STM32F407VET6_SPIFlash ... more

Revision:
3:b173ba8ad165
Parent:
1:17246d2dfff3
Child:
4:751745dd637f
--- a/SpiFlash25.cpp	Mon Dec 15 15:53:59 2014 -0600
+++ b/SpiFlash25.cpp	Mon Dec 15 16:35:47 2014 -0600
@@ -25,18 +25,20 @@
 SpiFlash25::SpiFlash25(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName W, PinName HOLD, int page_size)
 :   _spi(mosi, miso, sclk),
     _cs(cs),
-    _w(W),
-    _hold(HOLD),
     _page_size(page_size)
 {
     _cs.write(1);
     _spi.format(8, 3);
     _spi.frequency(75000000);
 
-    if (_w != NC)
-        _w = 1;
-    if (_hold != NC)
-        _hold = 1;
+    if (W != NC) {
+        _w = new DigitalOut(W);
+        _w->write(1);
+    }
+    if (HOLD != NC) {
+        _hold = new DigitalOut(HOLD);
+        _hold->write(1);
+    }
 
     _cs.write(0);
     _spi.write(READ_IDENTIFICATION);