39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
74#define FLASH11_CMD_ENABLE_RESET 0x66
75#define FLASH11_CMD_RESET_DEVICE 0x99
76#define FLASH11_CMD_DEEP_POWER_DOWN 0xB9
77#define FLASH11_CMD_RESUME_FROM_DPD 0xAB
83#define FLASH11_CMD_READ_ARRAY 0x03
84#define FLASH11_CMD_FAST_READ_ARRAY 0x0B
90#define FLASH11_CMD_WRITE_ENABLE 0x06
91#define FLASH11_CMD_VOLATILE_SR_WR_EN 0x50
92#define FLASH11_CMD_WRITE_DISABLE 0x04
98#define FLASH11_CMD_BYTE_PAGE_PROGRAM 0x02
104#define FLASH11_CMD_BLOCK_ERASE_4KB 0x20
105#define FLASH11_CMD_BLOCK_ERASE_32KB 0x52
106#define FLASH11_CMD_BLOCK_ERASE_64KB 0xD8
107#define FLASH11_CMD_CHIP_ERASE 0x60
113#define FLASH11_CMD_ERASE_PROGRAM_SUSPEND 0x75
114#define FLASH11_CMD_ERASE_PROGRAM_RESUME 0x7A
120#define FLASH11_CMD_READ_STATUS_1 0x05
121#define FLASH11_CMD_READ_STATUS_2 0x35
122#define FLASH11_CMD_READ_STATUS_3 0x15
123#define FLASH11_CMD_WRITE_STATUS_1 0x01
124#define FLASH11_CMD_WRITE_STATUS_2 0x31
125#define FLASH11_CMD_WRITE_STATUS_3 0x11
131#define FLASH11_CMD_MANUFACTURER_ID 0x90
132#define FLASH11_CMD_READ_JEDEC_ID 0x9F
133#define FLASH11_CMD_READ_SERIAL_FLASH_DP 0x5A
139#define FLASH11_CMD_ERASE_SECURITY_REG 0x44
140#define FLASH11_CMD_PROGRAM_SECURITY_REG 0x42
141#define FLASH11_CMD_READ_SECURITY_REG 0x48
142#define FLASH11_CMD_READ_UNIQUE_ID_NUM 0x4B
160#define FLASH11_STATUS1_SRP0_BIT_MASK 0x80
161#define FLASH11_STATUS1_BP4_BIT_MASK 0x40
162#define FLASH11_STATUS1_BP3_BIT_MASK 0x20
163#define FLASH11_STATUS1_BP2_BIT_MASK 0x10
164#define FLASH11_STATUS1_BP1_BIT_MASK 0x08
165#define FLASH11_STATUS1_BP0_BIT_MASK 0x04
166#define FLASH11_STATUS1_WEL_EN 0x02
167#define FLASH11_STATUS1_WEL_DIS 0x00
168#define FLASH11_STATUS1_BSY 0x01
169#define FLASH11_STATUS1_RDY 0x00
175#define FLASH11_MANUFACTURER_ID 0x1F
176#define FLASH11_DEVICE_ID_0 0x87
177#define FLASH11_DEVICE_ID_1 0x01
183#define FLASH11_MIN_ADDRESS 0x000000
184#define FLASH11_MAX_ADDRESS 0x3FFFFFul
185#define FLASH11_PAGE_SIZE 256
191#define FLASH11_WRITE_PROTECT_ENABLE 0
192#define FLASH11_WRITE_PROTECT_DISABLE 1
198#define FLASH11_HOLD_ENABLE 0
199#define FLASH11_HOLD_DISABLE 1
209#define FLASH11_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
210#define FLASH11_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
228#define FLASH11_MAP_MIKROBUS( cfg, mikrobus ) \
229 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
230 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
231 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
232 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
233 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
234 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_INT )
flash11_return_value_t
Flash 11 Click return value data.
Definition flash11.h:284
@ FLASH11_ERROR
Definition flash11.h:286
@ FLASH11_OK
Definition flash11.h:285
err_t flash11_write_disable(flash11_t *ctx)
Flash 11 write disable function.
err_t flash11_set_cmd(flash11_t *ctx, uint8_t opcode)
Flash 11 set the command function.
err_t flash11_read_cmd_addr_data(flash11_t *ctx, uint8_t opcode, uint32_t mem_addr, uint8_t *data_out, uint32_t len)
Flash 11 read command adress data function.
err_t flash11_memory_read(flash11_t *ctx, uint32_t mem_addr, uint8_t *data_out, uint32_t len)
Flash 11 memory read function.
err_t flash11_sw_reset(flash11_t *ctx)
Flash 11 sw reset function.
err_t flash11_get_status(flash11_t *ctx, uint8_t status_reg, uint8_t *status)
Flash 11 gets the status function.
void flash11_cfg_setup(flash11_cfg_t *cfg)
Flash 11 configuration object setup function.
err_t flash11_block_erase(flash11_t *ctx, uint8_t cmd_block_erase, uint32_t mem_addr)
Flash 11 block erase function.
void flash11_en_hold(flash11_t *ctx, uint8_t en_hold)
Flash 11 enable hold function.
err_t flash11_generic_read(flash11_t *ctx, uint8_t opcode, uint8_t *data_out, uint8_t len)
Flash 11 data reading function.
err_t flash11_chip_erase(flash11_t *ctx)
Flash 11 chip erase function.
err_t flash11_generic_write(flash11_t *ctx, uint8_t opcode, uint8_t *data_in, uint8_t len)
Flash 11 data writing function.
err_t flash11_memory_write(flash11_t *ctx, uint32_t mem_addr, uint8_t *data_in, uint32_t len)
Flash 11 memory write function.
err_t flash11_write_cmd_addr_data(flash11_t *ctx, uint8_t opcode, uint32_t mem_addr, uint8_t *data_in, uint32_t len)
Flash 11 write command adress data function.
err_t flash11_default_cfg(flash11_t *ctx)
Flash 11 default configuration function.
err_t flash11_write_enable(flash11_t *ctx)
Flash 11 write enable function.
err_t flash11_get_device_id(flash11_t *ctx, uint8_t *device_id)
Flash 11 gets the device ID function.
err_t flash11_init(flash11_t *ctx, flash11_cfg_t *cfg)
Flash 11 initialization function.
void flash11_hw_write_protect(flash11_t *ctx, uint8_t en_wp)
Flash 11 hardware write protect function.
err_t flash11_set_status(flash11_t *ctx, uint8_t status_reg, uint8_t status)
Flash 11 set status function.
This file contains SPI specific macros, functions, etc.
Flash 11 Click configuration object.
Definition flash11.h:261
pin_name_t hld
Definition flash11.h:270
spi_master_chip_select_polarity_t cs_polarity
Definition flash11.h:275
pin_name_t sck
Definition flash11.h:265
spi_master_mode_t spi_mode
Definition flash11.h:274
pin_name_t mosi
Definition flash11.h:264
uint32_t spi_speed
Definition flash11.h:273
pin_name_t wp
Definition flash11.h:269
pin_name_t miso
Definition flash11.h:263
pin_name_t cs
Definition flash11.h:266
Flash 11 Click context object.
Definition flash11.h:244
digital_out_t hld
Definition flash11.h:247
spi_master_t spi
Definition flash11.h:250
pin_name_t chip_select
Definition flash11.h:252
digital_out_t wp
Definition flash11.h:246