MX25R6435F Library

Dependents:   Demo_MX25Rxx35F_Serial_NOR_Flash_Testbench mbed-lorawan-pulga mbed-lorawan-pulga-serial_rx mbed-lorawan-pulga-gps-added_shared

Fork of SPI_MX25R by alec cohen

Revision:
3:b6bb8d236251
Parent:
2:f72110475fec
--- a/SPI_MX25R.cpp	Thu Jul 23 17:11:27 2015 +0000
+++ b/SPI_MX25R.cpp	Wed Mar 28 13:17:02 2018 +0000
@@ -303,3 +303,17 @@
     return( data ) ;
 }
 
+
+void SPI_MX25R::readNBytes(int addr, uint8_t *data, int nBytes) // read sequential n bytes
+{
+    int i;   
+    m_cs = CS_LOW ;
+    m_spi.write(CMD_READ) ;                         // send 03h
+    m_spi.write((addr >> 16)&0xFF) ;
+    m_spi.write((addr >>  8)&0xFF) ;
+    m_spi.write(addr & 0xFF) ;
+    for (i = 0 ; i < nBytes ; i++ ) {              // data: sequential data bytes
+        data[i] = m_spi.write(DUMMY) ;
+    } 
+    m_cs = CS_HIGH ;                               
+}
\ No newline at end of file