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"
78#define FLASH7_STAT_REG_LSB_SRP0 0x80
79#define FLASH7_STAT_REG_LSB_BP4 0x40
80#define FLASH7_STAT_REG_LSB_BP3 0x20
81#define FLASH7_STAT_REG_LSB_BP2 0x10
82#define FLASH7_STAT_REG_LSB_BP1 0x08
83#define FLASH7_STAT_REG_LSB_BP0 0x04
84#define FLASH7_STAT_REG_LSB_WEL 0x02
85#define FLASH7_STAT_REG_LSB_WIP 0x01
91#define FLASH7_STAT_REG_MSB_SUS1 0x80
92#define FLASH7_STAT_REG_MSB_CMP 0x40
93#define FLASH7_STAT_REG_MSB_LB3 0x20
94#define FLASH7_STAT_REG_MSB_LB2 0x10
95#define FLASH7_STAT_REG_MSB_LB1 0x08
96#define FLASH7_STAT_REG_MSB_SUS2 0x04
97#define FLASH7_STAT_REG_MSB_QE 0x02
98#define FLASH7_STAT_REG_MSB_SRP1 0x01
104#define FLASH7_MEMORY_ADDR_START 0x00000000
105#define FLASH7_MEMORY_ADDR_END 0x00FFFFFF
106#define FLASH7_MEM_SECTOR_LEN 0x00001000
107#define FLASH7_MEMORY_BLOCK_SIZE 0x00008000
130#define FLASH7_CMD_WRSR 0x01
131#define FLASH7_CMD_WRITE 0x02
132#define FLASH7_CMD_READ 0x03
133#define FLASH7_CMD_WRDI 0x04
134#define FLASH7_CMD_RDSR_LSB 0x05
135#define FLASH7_CMD_RDSR_MSB 0x35
136#define FLASH7_CMD_WREN 0x06
137#define FLASH7_CMD_FREAD 0x0B
138#define FLASH7_CMD_WEVSR 0x50
139#define FLASH7_CMD_SE 0x20
140#define FLASH7_CMD_BE_32KB 0x52
141#define FLASH7_CMD_BE_64KB 0xD8
142#define FLASH7_CMD_CE 0x60
143#define FLASH7_CMD_SLEEP 0xB9
144#define FLASH7_CMD_WAKE 0xAB
145#define FLASH7_CMD_REMS 0x90
146#define FLASH7_CMD_RDID 0x9F
147#define FLASH7_CMD_ID 0x4B
148#define FLASH7_CMD_ENRES 0x66
149#define FLASH7_CMD_RES 0x99
155#define FLASH7_WRITE_PROTECT_DISABLE 0x00
156#define FLASH7_WRITE_PROTECT_ENABLE 0x01
162#define FLASH7_HOLD_DISABLE 0x00
163#define FLASH7_HOLD_ENABLE 0x01
169#define FLASH7_DUMMY 0x00
187#define FLASH7_MAP_MIKROBUS( cfg, mikrobus ) \
188 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
189 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
190 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
191 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
192 cfg.io2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
193 cfg.io3 = MIKROBUS( mikrobus, MIKROBUS_INT )
flash7_return_value_t
Flash 7 Click return value data.
Definition flash7.h:244
@ FLASH7_OK
Definition flash7.h:245
@ FLASH7_ERROR
Definition flash7.h:246
void flash7_read_memory(flash7_t *ctx, uint32_t mem_addr, uint8_t *p_rx_data, uint16_t n_bytes)
Read memory function.
void flash7_hold(flash7_t *ctx, uint8_t en_hold)
Enable hold operation function.
void flash7_send_command(flash7_t *ctx, uint8_t cmd)
Send command function.
uint8_t flash7_wake_up(flash7_t *ctx)
Wake up function.
void flash7_chip_erase(flash7_t *ctx)
Chip erase function.
void flash7_write_enable(flash7_t *ctx)
Write enable function.
void flash7_read_id(flash7_t *ctx, uint8_t *manufacturer_id, uint8_t *device_id)
Read ID function.
uint8_t flash7_block_erase(flash7_t *ctx, uint8_t mem_block, uint8_t mem_block_len)
Block erase function.
void flash7_write_protect(flash7_t *ctx, uint8_t en_write_protect)
Enable write protect function.
void flash7_get_identification(flash7_t *ctx, uint8_t *manufacturer_id, uint8_t *memory_type_id, uint8_t *capacity_id)
Get identification function.
void flash7_cfg_setup(flash7_cfg_t *cfg)
Flash 7 configuration object setup function.
uint8_t flash7_sector_erase(flash7_t *ctx, uint16_t mem_sector)
Sector erase function.
err_t flash7_init(flash7_t *ctx, flash7_cfg_t *cfg)
Flash 7 initialization function.
err_t flash7_generic_write(flash7_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Flash 7 data writing function.
void flash7_write_status_register(flash7_t *ctx, uint16_t status_data)
Write status register function.
uint8_t flash7_read_status_register(flash7_t *ctx, uint8_t status_byte)
Read status register function.
err_t flash7_generic_read(flash7_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Flash 7 data reading function.
void flash7_go_to_sleep(flash7_t *ctx)
Go to sleep mode function.
void flash7_sw_reset(flash7_t *ctx)
Soft reset function.
uint8_t flash7_page_program(flash7_t *ctx, uint32_t mem_addr, uint8_t *p_tx_data, uint16_t n_bytes)
Page program function.
void flash7_write_disable(flash7_t *ctx)
Write disable function.
err_t flash7_default_cfg(flash7_t *ctx)
Flash 7 default configuration function.
void flash7_fast_read_memory(flash7_t *ctx, uint32_t mem_addr, uint8_t *p_rx_data, uint16_t n_bytes)
Fast read memory function.
Flash 7 Click configuration object.
Definition flash7.h:220
spi_master_chip_select_polarity_t cs_polarity
Definition flash7.h:235
pin_name_t io2
Definition flash7.h:229
pin_name_t sck
Definition flash7.h:224
spi_master_mode_t spi_mode
Definition flash7.h:234
pin_name_t mosi
Definition flash7.h:223
uint32_t spi_speed
Definition flash7.h:233
pin_name_t miso
Definition flash7.h:222
pin_name_t io3
Definition flash7.h:230
pin_name_t cs
Definition flash7.h:225
Flash 7 Click context object.
Definition flash7.h:203
spi_master_t spi
Definition flash7.h:209
digital_out_t io3
Definition flash7.h:206
digital_out_t io2
Definition flash7.h:205
pin_name_t chip_select
Definition flash7.h:211