mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/driver-w25qxxx.git
synced 2025-08-01 20:21:53 +00:00
Some driver updates to work for the W25Q128
This commit is contained in:
parent
28f1f1ecce
commit
b6122a2dd8
@ -2,7 +2,7 @@
|
||||
#define STA_SENSORS_W25Q128_HPP
|
||||
|
||||
#include <sta/bus/spi/device.hpp>
|
||||
#include <sta/sensors/w25qxx_defs.hpp>
|
||||
#include <sta/drivers/w25qxx_defs.hpp>
|
||||
|
||||
|
||||
namespace sta
|
@ -1,9 +1,8 @@
|
||||
#include <sta/sensors/w25qxx.hpp>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <sta/debug/assert.hpp>
|
||||
#include <sta/debug/debug.hpp>
|
||||
#include <sta/drivers/w25qxx.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
@ -18,6 +17,13 @@ namespace sta
|
||||
|
||||
uint8_t W25Qxx::init()
|
||||
{
|
||||
powerDown();
|
||||
|
||||
if (!releasePowerDown())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check if the chip returns the correct device id.
|
||||
if (getManufacturerID() != W25QXX_DEVICE_ID_RESULT)
|
||||
{
|
||||
@ -33,11 +39,6 @@ namespace sta
|
||||
}
|
||||
}
|
||||
|
||||
if (!releasePowerDown())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -69,11 +70,11 @@ namespace sta
|
||||
uint8_t W25Qxx::getManufacturerID()
|
||||
{
|
||||
uint8_t dummy[3] = {0, 0, 0};
|
||||
uint8_t id;
|
||||
uint8_t id[2] = {0, 0};
|
||||
|
||||
busRead(W25QXX_DEVICE_ID, &id, 1, dummy, 3);
|
||||
busRead(W25QXX_DEVICE_ID, id, 2, dummy, 3);
|
||||
|
||||
return id;
|
||||
return id[0];
|
||||
}
|
||||
|
||||
uint64_t W25Qxx::getUniqueID()
|
||||
@ -98,7 +99,7 @@ namespace sta
|
||||
uint8_t status = 0;
|
||||
readStatusRegister(1, &status);
|
||||
|
||||
return (0x01 && status) == 0x01;
|
||||
return (0x01 & status) == 0x01;
|
||||
}
|
||||
|
||||
uint8_t W25Qxx::readData(uint32_t address, uint8_t * buffer, size_t length, bool fast /* = true */)
|
||||
@ -293,7 +294,7 @@ namespace sta
|
||||
uint8_t status = 0;
|
||||
readStatusRegister(1, &status);
|
||||
|
||||
return (0x02 && status) == 0x02;
|
||||
return (0x02 & status) == 0x02;
|
||||
}
|
||||
|
||||
uint8_t W25Qxx::sectorErase(uint32_t address)
|
||||
|
Loading…
x
Reference in New Issue
Block a user