Flash handler for M25P* chips with no Device ID.

Dependencies:   RTOS_SPI_Clean

Fork of flash25spi by Klaus Steinhammer

Revision:
8:7b09546cb412
Parent:
6:94558d4243f8
--- a/flash25spi.h	Mon Apr 28 10:39:17 2014 +0000
+++ b/flash25spi.h	Fri Jun 27 10:13:16 2014 +0000
@@ -31,10 +31,15 @@
 */
 
 #pragma once
+
+// RTOS DMA-enabled version
+#include "rtos.h"
+#include "RTOS_SPI.h"
+
 #include "mbed.h"
 
 /**
-An interface class to read and write M25P* serial SPI flash devices.
+An RTOS interface class to read and write M25P* serial SPI flash devices.
 Supports M25P10-A and M25P40 ICs with no Device ID.
 */
 class FlashM25PSpi
@@ -43,11 +48,12 @@
     /**
         Create the flash interface class.
         It will autodetect the Signature of your device. If your device is not recognized, add the devices parameters to the device data structure.
-        @param spi the SPI port where the flash is connected. Must be set to speed matching your device.
-        Will automatically set it to format(8,3).
+        @param spi the RTOS_SPI port where the flash is connected. Must be set to speed matching your device.
         @param enable the pin name for the port where /CS is connected
+        @param bits SPI bits format. If zero, leave SPI Format unchanged
+        @param mode SPI mode.
     */
-    FlashM25PSpi(SPI *spi, PinName enable);
+    FlashM25PSpi(RTOS_SPI *spi, PinName enable, int bits = 8, int mode = 3);
 
     /**
         Destroy the interface and power down the flash chip
@@ -103,13 +109,13 @@
     }
 
 private:
-    bool writePage(uint32_t startAddr, const char* data, size_t len);
+    bool writePage(uint32_t startAddr, const uint8_t* data, size_t len);
     int readStatus();
     void waitForWrite();
     void enableWrite();
 
+    RTOS_SPI* _spi;
 
-    SPI* _spi;
     DigitalOut _enable;
     size_t _size, _pageSize, _sectorSize;
 };