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 FLASH10_CMD_READ_ARRAY 0x03
75#define FLASH10_CMD_FAST_READ_ARRAY 0x0B
81#define FLASH10_CMD_BLOCK_ERASE_4KB 0x20
82#define FLASH10_CMD_BLOCK_ERASE_32KB 0x52
83#define FLASH10_CMD_BLOCK_ERASE_64KB 0xD8
84#define FLASH10_CMD_CHIP_ERASE 0x60
85#define FLASH10_CMD_BYTE_PAGE_PROGRAM 0x02
86#define FLASH10_CMD_SEQUENTIAL_PROGRAM 0xAD
87#define FLASH10_CMD_ERASE_PROGRAM_SUSPEND 0x75
88#define FLASH10_CMD_ERASE_PROGRAM_RESUME 0x7A
94#define FLASH10_CMD_WRITE_ENABLE 0x06
95#define FLASH10_CMD_WRITE_DISABLE 0x04
96#define FLASH10_CMD_VOLATILE_STATUS 0x50
97#define FLASH10_CMD_INDIVIDUAL_BLOCK_LOCK 0x36
98#define FLASH10_CMD_INDIVIDUAL_BLOCK_UNLOCK 0x39
99#define FLASH10_CMD_READ_BLOCK_LOCK 0x3C
100#define FLASH10_CMD_GLOBAL_BLOCK_LOCK 0x7E
101#define FLASH10_CMD_GLOBAL_BLOCK_UNLOCK 0x98
107#define FLASH10_CMD_PROGRAM_OTP_SECURITY 0x9B
108#define FLASH10_CMD_READ_OTP_SECURITY 0x4B
114#define FLASH10_CMD_READ_STATUS_1 0x05
115#define FLASH10_CMD_READ_STATUS_2 0x35
116#define FLASH10_CMD_READ_STATUS_3 0x15
117#define FLASH10_CMD_READ_STATUS_4 0x65
118#define FLASH10_CMD_READ_STATUS_5 0x65
119#define FLASH10_CMD_WRITE_STATUS_1 0x01
120#define FLASH10_CMD_WRITE_STATUS_2 0x31
121#define FLASH10_CMD_WRITE_STATUS_3 0x11
122#define FLASH10_CMD_WRITE_STATUS_4 0x71
123#define FLASH10_CMD_WRITE_STATUS_5 0x71
124#define FLASH10_CMD_READ_STATUS 0x65
125#define FLASH10_CMD_WRITE_STATUS 0x71
126#define FLASH10_CMD_STATUS_LOCK 0x6F
132#define FLASH10_CMD_DEEP_POWER_DOWN 0xB9
133#define FLASH10_CMD_ULTRA_DEEP_POWER_DOWN 0x79
134#define FLASH10_CMD_RESUME_FROM_DPD 0xAB
140#define FLASH10_CMD_ENABLE_RESET 0x66
141#define FLASH10_CMD_RESET_DEVICE 0x99
142#define FLASH10_CMD_TERMINATE 0xF0
148#define FLASH10_CMD_MANUFACTURER_ID 0x90
149#define FLASH10_CMD_JEDEC_ID 0x9F
155#define FLASH10_CMD_READ_SFDP 0x5A
173#define FLASH10_STATUS_REG_1 1
174#define FLASH10_STATUS_REG_2 2
175#define FLASH10_STATUS_REG_3 3
176#define FLASH10_STATUS_REG_4 4
177#define FLASH10_STATUS_REG_5 5
183#define FLASH10_STATUS1_SRP0 0x80
184#define FLASH10_STATUS1_BPSIZE 0x40
185#define FLASH10_STATUS1_TB 0x20
186#define FLASH10_STATUS1_WEL 0x02
187#define FLASH10_STATUS1_BSY 0x01
193#define FLASH10_MIN_ADDRESS 0x000000
194#define FLASH10_MAX_ADDRESS 0x3FFFFFul
195#define FLASH10_PAGE_SIZE 256
201#define FLASH10_MANUFACTURER_ID 0x1F
202#define FLASH10_DEVICE_ID 0x47
212#define FLASH10_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
213#define FLASH10_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
231#define FLASH10_MAP_MIKROBUS( cfg, mikrobus ) \
232 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
233 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
234 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
235 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
236 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
237 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM );
flash10_return_value_t
Flash 10 Click return value data.
Definition flash10.h:287
@ FLASH10_OK
Definition flash10.h:288
@ FLASH10_ERROR
Definition flash10.h:289
void flash10_set_wp_pin(flash10_t *ctx, uint8_t state)
Flash 10 set wp pin function.
err_t flash10_soft_reset(flash10_t *ctx)
Flash 10 soft reset function.
err_t flash10_write_cmd_data(flash10_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
Flash 10 write cmd data function.
err_t flash10_read_cmd_data(flash10_t *ctx, uint8_t cmd, uint8_t *data_out, uint8_t len)
Flash 10 read cmd data function.
err_t flash10_check_communication(flash10_t *ctx)
Flash 10 check communication function.
err_t flash10_write_cmd(flash10_t *ctx, uint8_t cmd)
Flash 10 write cmd function.
err_t flash10_write_protect(flash10_t *ctx)
Flash 10 write protect function.
err_t flash10_read_cmd_address_data(flash10_t *ctx, uint8_t cmd, uint32_t address, uint8_t *data_out, uint32_t len)
Flash 10 read cmd address data function.
err_t flash10_init(flash10_t *ctx, flash10_cfg_t *cfg)
Flash 10 initialization function.
void flash10_cfg_setup(flash10_cfg_t *cfg)
Flash 10 configuration object setup function.
err_t flash10_read_status(flash10_t *ctx, uint8_t status_reg_num, uint8_t *status)
Flash 10 read status function.
err_t flash10_erase_memory(flash10_t *ctx, uint8_t erase_cmd, uint32_t address)
Flash 10 erase memory function.
err_t flash10_memory_write(flash10_t *ctx, uint32_t address, uint8_t *data_in, uint32_t len)
Flash 10 memory write function.
void flash10_set_rst_pin(flash10_t *ctx, uint8_t state)
Flash 10 set rst pin function.
err_t flash10_write_status(flash10_t *ctx, uint8_t status_reg_num, uint8_t status)
Flash 10 write status function.
err_t flash10_write_enable(flash10_t *ctx)
Flash 10 write enable function.
err_t flash10_memory_read(flash10_t *ctx, uint32_t address, uint8_t *data_out, uint32_t len)
Flash 10 memory read function.
err_t flash10_write_cmd_address_data(flash10_t *ctx, uint8_t cmd, uint32_t address, uint8_t *data_in, uint32_t len)
Flash 10 write cmd address data function.
This file contains SPI specific macros, functions, etc.
Flash 10 Click configuration object.
Definition flash10.h:264
spi_master_chip_select_polarity_t cs_polarity
Definition flash10.h:278
pin_name_t sck
Definition flash10.h:268
spi_master_mode_t spi_mode
Definition flash10.h:277
pin_name_t mosi
Definition flash10.h:267
uint32_t spi_speed
Definition flash10.h:276
pin_name_t wp
Definition flash10.h:273
pin_name_t miso
Definition flash10.h:266
pin_name_t rst
Definition flash10.h:272
pin_name_t cs
Definition flash10.h:269
Flash 10 Click context object.
Definition flash10.h:247
spi_master_t spi
Definition flash10.h:253
digital_out_t rst
Definition flash10.h:249
pin_name_t chip_select
Definition flash10.h:255
digital_out_t wp
Definition flash10.h:250