SPI device driver for WinBond flash memory chips, like W25Q80BV (8 Mbit flash).
More...
#include <fastarduino/devices/winbond.h>
|
enum class | BlockProtect : uint16_t {
BLOCK_NONE = 0x00
,
BLOCK_UPPER_64KB = 0x01 << 2
,
BLOCK_UPPER_128KB = 0x02 << 2
,
BLOCK_UPPER_256KB = 0x03 << 2
,
BLOCK_UPPER_512KB = 0x04 << 2
,
BLOCK_LOWER_64KB = 0x09 << 2
,
BLOCK_LOWER_128KB = 0x0A << 2
,
BLOCK_LOWER_256KB = 0x0B << 2
,
BLOCK_LOWER_512KB = 0x0C << 2
,
BLOCK_ALL = 0x07 << 2
,
BLOCK_UPPER_4KB = 0x11 << 2
,
BLOCK_UPPER_8KB = 0x12 << 2
,
BLOCK_UPPER_16KB = 0x13 << 2
,
BLOCK_UPPER_32KB = 0x14 << 2
,
BLOCK_LOWER_4KB = 0x19 << 2
,
BLOCK_LOWER_8KB = 0x1A << 2
,
BLOCK_LOWER_16KB = 0x1B << 2
,
BLOCK_LOWER_32KB = 0x1C << 2
} |
| This enum provides information about block protection (bits BP0-2, TB and SEC of Status register, §6.1.3, §6.1.4 & §6.1.5) in a more readable way. More...
|
|
enum class | StatusRegisterProtect : uint16_t {
SOFTWARE_PROTECTION = 0x0000
,
HARDWARE_PROTECTION = 0x0080
,
POWER_SUPPLY_LOCKDOWN = 0x0100
} |
| This enum provides information about the method of write protection of the Status register itself (bits SRP0-1 of Status register, §6.1.7). More...
|
|
|
| SPIDevice () INLINE=default |
| Create a new SPIDevice ; this sets up the CS pin for later use during transfers.
|
|
void | start_transfer () |
| Start an SPI transfer to this device. More...
|
|
void | end_transfer () INLINE |
| End the current SPI ransfer tot hsi device. More...
|
|
| AbstractSPIDevice (const AbstractSPIDevice &)=delete |
|
AbstractSPIDevice & | operator= (const AbstractSPIDevice &)=delete |
|
uint8_t | transfer (uint8_t data) |
| Transfer one byte to the currently selected SPI slave device through MOSI pin, and get the byte returned by the device through MISO pin. More...
|
|
void | transfer (uint8_t *data, uint16_t size) |
| Transfer an array of payload data to the currently selected SPI slave device through MOSI pin, and get all data bytes simultaneously received from that device through MISO pin. More...
|
|
void | transfer (const uint8_t *data, uint16_t size) |
| Transfer an array of payload data to the currently selected SPI slave device through MOSI pin; any data bytes simultaneously received from that device through MISO pin are lost. More...
|
|
void | transfer (uint8_t *data, uint16_t size, uint8_t sent) |
| Transfer the provided byte sent several times to the currently selected SPI slave device through MOSI pin, and get all data bytes simultaneously received from that device through MISO pin. More...
|
|
void | transfer (uint16_t size, uint8_t sent) |
| Transfer the provided byte sent several times to the currently selected SPI slave device through MOSI pin; any data bytes simultaneously received from that device through MISO pin are lost. More...
|
|
SPI device driver for WinBond flash memory chips, like W25Q80BV (8 Mbit flash).
- Template Parameters
-
CS | the output pin used for Chip Selection of the WinBond chip on the SPI bus. |
Definition at line 54 of file winbond.h.
◆ BlockProtect
This enum provides information about block protection (bits BP0-2, TB and SEC of Status register, §6.1.3, §6.1.4 & §6.1.5) in a more readable way.
- See also
- Status::block_protect()
-
status()
Definition at line 69 of file winbond.h.
◆ StatusRegisterProtect
This enum provides information about the method of write protection of the Status register itself (bits SRP0-1 of Status register, §6.1.7).
- See also
- Status::status_register_protect()
-
status()
Definition at line 100 of file winbond.h.
◆ status()
Get the value of the chip's Status register (§6.1, §6.2.8).
Definition at line 165 of file winbond.h.
◆ set_status()
Change the Status register (only writable bits, §6.2.9).
- Parameters
-
status | the new value for the Status register |
Definition at line 345 of file winbond.h.
◆ wait_until_ready()
Wait until any erase or write operation is finished.
This method continuously reads the Status register and check the BUSY bit (§6.1.1). If the chip is busy, then the method yields time, i.e. put the MCU to sleep according to the default board::SleepMode
.
- Parameters
-
timeout_ms | the maximum time, in milliseconds, to wait for the chip to be ready |
- Return values
-
true | if the chip is ready |
false | if the chip is still busy after timeout_ms delay |
- See also
- time::yield()
-
power::Power::set_default_mode()
Definition at line 353 of file winbond.h.
◆ power_down()
Set the chip to low power mode (§6.2.29).
Definition at line 194 of file winbond.h.
◆ power_up()
Release power-down mode (§6.2.30).
Definition at line 202 of file winbond.h.
◆ read_device()
Get device informaton §6.2.31).
Definition at line 374 of file winbond.h.
◆ read_unique_ID()
Get chip unique ID (§6.2.34).
Definition at line 381 of file winbond.h.
◆ enable_write()
Enable write mode for the chip (§6.2.5).
This must becalled before every erase or write instruction.
Definition at line 234 of file winbond.h.
◆ disable_write()
Disable chip write mode (§6.2.7).
This method is seldom used, as any erase or write instruction will automatically disable write mode.
Definition at line 243 of file winbond.h.
◆ erase_sector()
Erase the sector (4KB) at address
(§6.2.23).
- Parameters
-
address | address (24 bits) of the sector to erase |
- See also
- enable_write()
Definition at line 253 of file winbond.h.
◆ erase_block_32K()
Erase the block (32KB) at address
(§6.2.24).
- Parameters
-
address | address (24 bits) of the sector to erase |
- See also
- enable_write()
Definition at line 263 of file winbond.h.
◆ erase_block_64K()
Erase the sector (64KB) at address
(§6.2.25).
- Parameters
-
address | address (24 bits) of the sector to erase |
- See also
- enable_write()
Definition at line 273 of file winbond.h.
◆ erase_chip()
◆ write_page()
void devices::WinBond< CS >::write_page |
( |
uint32_t |
address, |
|
|
uint8_t * |
data, |
|
|
uint8_t |
size |
|
) |
| |
|
inline |
Write data (max 256 bytes) to a page (§6.2.21).
- Parameters
-
address | address (24 bits) of the first flash byte to write |
data | the data to be written to the flash page at address ; data may be overwritten by this operation. |
size | the number of bytes to write; if 0 , then 256 bytes (one full page) will be written. |
Definition at line 295 of file winbond.h.
◆ read_data() [1/2]
Read one byte of flash memory (§6.2.10).
- Parameters
-
address | address (24 bits) of the flash byte to read |
- Returns
- the value read from flash memory
Definition at line 399 of file winbond.h.
◆ read_data() [2/2]
void devices::WinBond< CS >::read_data |
( |
uint32_t |
address, |
|
|
uint8_t * |
data, |
|
|
uint16_t |
size |
|
) |
| |
Read several bytes of flash memory (§6.2.10).
- Parameters
-
address | address (24 bits) of the first flash byte to read |
data | the buffer that shall receive the value of all read bytes; this must have been allocated at leat size bytes |
size | the number of bytes to read from flash memory |
Definition at line 406 of file winbond.h.
The documentation for this class was generated from the following file: