forked driver
Dependents: ESHD_L475VG_IOT01-Sensors-BSP
Diff: MB85RSxx_SPI.cpp
- Revision:
- 2:9a0f9faada7f
- Parent:
- 0:c31c06ec36da
- Child:
- 3:f31e1990e1f3
diff -r c31c06ec36da -r 9a0f9faada7f MB85RSxx_SPI.cpp --- a/MB85RSxx_SPI.cpp Thu Jun 22 08:30:47 2017 +0000 +++ b/MB85RSxx_SPI.cpp Fri Aug 18 05:27:05 2017 +0000 @@ -3,7 +3,7 @@ * @file MB85RSxx_SPI.cpp * @author APS Lab * @version V1.0.0 - * @date 16 June 2017 + * @date 26 June 2017 * @brief MB85RSxx_SPI class implementation ****************************************************************************** * @attention @@ -59,7 +59,7 @@ wait(0.2); _di=0; _spi.write(WRSR); - _spi.write(0x02); + _spi.write(SR_WEL); _di=1; wait(0.2); _di=0; @@ -76,8 +76,8 @@ _di=1; _di=0; _spi.write(WRITE); - _spi.write((address & 0x3F00) >> 8);//Addr H - _spi.write((address & 0x00FF)); //Addr L + _spi.write((address & 0x3F00) >> 8);//Addr H for 64Kbits + _spi.write((address & 0x00FF)); //Addr L for 64Kbits _spi.write(data); //Write Data _di=1; } @@ -87,8 +87,8 @@ char ch; _di=0; _spi.write(READ); - _spi.write((address & 0x3F00) >> 8);//Addr H - _spi.write((address & 0x00FF)); //Addr L + _spi.write((address & 0x3F00) >> 8);//Addr H for 64Kbits + _spi.write((address & 0x00FF)); //Addr L for 64Kbits ch = _spi.write(0x00);//Write dummy 0x00, Reade Data _di=1; return ch; @@ -104,14 +104,12 @@ } } -uint32_t MB85RSxx_SPI::read(uint32_t address, char *data, uint32_t length) +void MB85RSxx_SPI::read(uint32_t address, char *data, uint32_t length) { - uint32_t error=0; uint32_t idx; for(idx=0; idx < length; idx++) { *(data+idx) = MB85RSxx_SPI::read(address+idx); } - return error; }