flash5 2.0.0.0
flash5.h File Reference

This file contains API for Flash 5 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  flash5_t
 Click ctx object definition. More...
 
struct  flash5_cfg_t
 Click configuration structure definition. More...
 

Macros

#define FLASH5_MAP_MIKROBUS(cfg, mikrobus)
 
#define FLASH5_RETVAL   uint8_t
 
#define FLASH5_OK   0x00
 
#define FLASH5_INIT_ERROR   0xFF
 
#define FLASH5_MAX_addr   0xFFFF
 
#define FLASH5_PAGESIZE   2048
 
#define FLASH5_CMD_RESET   0xFF
 
#define FLASH5_CMD_DEVICE_ID   0x9F
 
#define FLASH5_CMD_READ_REG_STATUS1   0x05
 
#define FLASH5_CMD_READ_REG_STATUS2   0x0F
 
#define FLASH5_CMD_WRITE_REG_STATUS1   0x01
 
#define FLASH5_CMD_WRITE_REG_STATUS2   0x1F
 
#define FLASH5_CMD_WRITE_ENABLE   0x06
 
#define FLASH5_CMD_WRITE_DISABLE   0x04
 
#define FLASH5_CMD_BAD_BLOCK_MANAGE   0xA1
 
#define FLASH5_CMD_READ_BBM_TABLE   0xA5
 
#define FLASH5_CMD_LAST_ECC_FAIL_PAGE   0xA9
 
#define FLASH5_CMD_BLOCK_ERASE   0xD8
 
#define FLASH5_CMD_LOAD_DATA   0x02
 
#define FLASH5_CMD__RND_LOAD_DATA   0x84
 
#define FLASH5_CMD_QUAD_LOAD_DATA   0x32
 
#define FLASH5_CMD_QUAD_RND_LOAD_DATA   0x34
 
#define FLASH5_CMD_EXECUTE   0x10
 
#define FLASH5_CMD_PAGE_READ_DATA   0x13
 
#define FLASH5_CMD_READ_DATA   0x03
 
#define FLASH5_CMD_FAST_READ   0x0B
 
#define FLASH5_CMD_FAST_READ_4BYTE_addr   0x0C
 
#define FLASH5_CMD_FAST_READ_DUAL_OUT   0x3B
 
#define FLASH5_CMD_FAST_READ_DUAL_OUT_4BYTE_addr   0x3C
 
#define FLASH5_CMD_FAST_READ_QUAD_OUT   0x6B
 
#define FLASH5_CMD_FAST_READ_QUAD_OUT_4BYTE_addr   0x6C
 
#define FLASH5_CMD_FAST_READ_DUAL_IO   0xBB
 
#define FLASH5_CMD_FAST_READ_IO_4BYTE_addr   0xBC
 
#define FLASH5_CMD_FAST_READ_QUAD_IO   0xEB
 
#define FLASH5_CMD_FAST_READ_QUAD_IO_4BYTE_addr   0xEC
 
#define FLASH5_REG_STATUS_1   0xA0
 
#define FLASH5_REG_STATUS_2   0xB0
 
#define FLASH5_REG_STATUS_3   0xC0
 
#define FLASH5_RS1_WRITE_PROTECTION_ENABLE   0x02
 
#define FLASH5_RS1_WRITE_PROTECTION_DISABLE   0x00
 
#define FLASH5_RS1_SRP1_ENABLE   0x01
 
#define FLASH5_RS1_SRP2_ENABLE   0x80
 
#define FLASH5_RS2_PAGE_READ_MODE   0x08
 
#define FLASH5_RS2_PAGE_CONTINOUS_READ_MODE   0x00
 
#define FLASH5_RS2_ECC_ENABLED   0x10
 
#define FLASH5_RS2_ECC_DISABLED   0x10
 
#define FLASH5_RS2_OTP_LOCK   0x80
 
#define FLASH5_RS2_OTP_ACCESS   0x40
 
#define FLASH5_RS2_REG_STATUS_1_LOCK   0x20
 
#define FLASH5_DEVICE_OK   0xFF
 
#define FLASH5_DEVICE_ERROR   0xAA
 
#define FLASH5_PIN_STATUS_HIGH   1
 
#define FLASH5_PIN_STATUS_LOW   0
 

Functions

void flash5_cfg_setup (flash5_cfg_t *cfg)
 Config Object Initialization function.
 
FLASH5_RETVAL flash5_init (flash5_t *ctx, flash5_cfg_t *cfg)
 Initialization function.
 
void flash5_generic_transfer (flash5_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
void flash5_read_data (flash5_t *ctx, uint8_t reg_addr, uint8_t *data_buf, uint16_t n_buf_size)
 Generic funcion for reading.
 
void flash5_write_data (flash5_t *ctx, uint8_t reg_addr, uint8_t *data_buf, uint16_t n_buf_size)
 Generic funcion for writing.
 
void flash5_send_cmd (flash5_t *ctx, uint8_t cmd_data)
 Function for sending one Byte od data.
 
uint8_t flash5_set_wp_pin (flash5_t *ctx, uint8_t status)
 Sets wp pin to one state.
 
uint8_t flash5_set_hold_pin (flash5_t *ctx, uint8_t status)
 Sets hold pin to one state.
 
uint8_t flash5_device_id_check (flash5_t *ctx)
 Funcion for checking device id.
 
void flash5_page_read (flash5_t *ctx, uint16_t page_num)
 Function for setting page read.
 
void flash5_execute_load (flash5_t *ctx, uint16_t page_num)
 Function for executing page load.
 
void flash5_page_read_memory (flash5_t *ctx, uint16_t column_addr, uint8_t *data_buf, uint16_t buf_size)
 Function for reading one page.
 
void flash5_continous_read_memory (flash5_t *ctx, uint8_t *data_buf, uint16_t buf_size)
 Function for continous reading.
 
void flash5_page_load_memory (flash5_t *ctx, uint16_t column_addr, uint8_t *data_buf, uint16_t buf_size)
 Function for loading one page.
 
uint8_t flash5_read_status_data (flash5_t *ctx, uint8_t status_cmd, uint8_t status_addr)
 Function for reading status data.
 
void flash5_write_status_data (flash5_t *ctx, uint8_t status_cmd, uint8_t status_addr, uint8_t status_data)
 Function for writing status data.
 
void flash5_software_reset (flash5_t *ctx)
 Function for reseting device.
 
void flash5_erase_page_data (flash5_t *ctx, uint16_t page_addr)
 Function for eraseing one page.
 

Detailed Description

This file contains API for Flash 5 Click driver.