flash 2.0.0.0
Public Function

Functions

void flash_cfg_setup (flash_cfg_t *cfg)
 Config Object Setup function.
 
flash_err_t flash_init (flash_t *ctx, flash_cfg_t *cfg)
 Click Initialization function.
 
void flash_default_cfg (flash_t *ctx)
 Click Default Configuration function.
 
void flash_reset (flash_t *ctx)
 Reset function.
 
void flash_write_enable (flash_t *ctx)
 Write Enable function.
 
void flash_write_disable (flash_t *ctx)
 Write Disable function.
 
void flash_write_status (flash_t *ctx, uint8_t data_tx)
 Status Write function.
 
uint8_t flash_read_status (flash_t *ctx)
 Status Read function.
 
void flash_read_id (flash_t *ctx, uint8_t *manufact_id, uint16_t *dev_id)
 ID Read function.
 
flash_err_t flash_write_byte (flash_t *ctx, uint32_t mem_addr, uint8_t data_tx)
 Byte Write function.
 
flash_err_t flash_read_byte (flash_t *ctx, uint32_t mem_addr, uint8_t *data_rx)
 Byte Read function.
 
flash_err_t flash_write_page (flash_t *ctx, uint32_t mem_addr, uint8_t *data_tx, uint16_t n_data)
 Page Write function.
 
flash_err_t flash_read_page (flash_t *ctx, uint32_t mem_addr, uint8_t *data_rx, uint16_t n_data)
 Page Read function.
 
void flash_erase_chip (flash_t *ctx)
 Chip Erase function.
 
flash_err_t flash_erase_block (flash_t *ctx, uint32_t mem_addr)
 Block Erase function.
 
flash_err_t flash_erase_half_block (flash_t *ctx, uint32_t mem_addr)
 Half Block Erase function.
 
flash_err_t flash_erase_sector (flash_t *ctx, uint32_t mem_addr)
 Sector Erase function.
 
void flash_set_write_protect_pin (flash_t *ctx, flash_pin_state_t state)
 WP Pin Set function.
 
void flash_set_hold_pin (flash_t *ctx, flash_pin_state_t state)
 HLD Pin Set function.
 

Detailed Description

Function Documentation

◆ flash_cfg_setup()

void flash_cfg_setup ( flash_cfg_t * cfg)

Config Object Setup function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to initial state.

Note
All used pins will be set to unconnected state.

◆ flash_default_cfg()

void flash_default_cfg ( flash_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Flash click.

◆ flash_erase_block()

flash_err_t flash_erase_block ( flash_t * ctx,
uint32_t mem_addr )

Block Erase function.

Parameters
ctxClick object.
mem_addrMemory address.
Returns
0x0 - Ok, 0xFE - Invalid memory address.

@description This function sets to 1 (FFh) all bits inside the chosen block.

Note
Write Enable Latch will be set automatically and reset after cycle was done.

◆ flash_erase_chip()

void flash_erase_chip ( flash_t * ctx)

Chip Erase function.

Parameters
ctxClick object.

@description This function sets all bits to 1 (FFh).

Note
Write Enable Latch will be set automatically and reset after cycle was done.

◆ flash_erase_half_block()

flash_err_t flash_erase_half_block ( flash_t * ctx,
uint32_t mem_addr )

Half Block Erase function.

Parameters
ctxClick object.
mem_addrMemory address.
Returns
0x0 - Ok, 0xFE - Invalid memory address.

@description This function sets to 1 (FFh) all bits inside the chosen block of memory.

Note
Write Enable Latch will be set automatically and reset after cycle was done.

◆ flash_erase_sector()

flash_err_t flash_erase_sector ( flash_t * ctx,
uint32_t mem_addr )

Sector Erase function.

Parameters
ctxClick object.
mem_addrMemory address.
Returns
0x0 - Ok, 0xFE - Invalid memory address.

@description This function sets to 1 (FFh) all bits inside the chosen sector.

Note
Write Enable Latch will be set automatically and reset after cycle was done.

◆ flash_init()

flash_err_t flash_init ( flash_t * ctx,
flash_cfg_t * cfg )

Click Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.
Returns
0x0 - Ok, 0xFD - Driver init error.

@description This function initializes all necessary pins and peripherals used for this click.

◆ flash_read_byte()

flash_err_t flash_read_byte ( flash_t * ctx,
uint32_t mem_addr,
uint8_t * data_rx )

Byte Read function.

Parameters
ctxClick object.
mem_addrMemory address.
data_rxData which was read.
Returns
0x0 - Ok, 0xFE - Invalid memory address.

@description This function reads one byte data from the selected memory address.

◆ flash_read_id()

void flash_read_id ( flash_t * ctx,
uint8_t * manufact_id,
uint16_t * dev_id )

ID Read function.

Parameters
ctxClick object.
manufact_idManufacturer identification.
dev_idDevice identification.

@description This function reads one byte of manufacturer identification and two bytes of device identification.

◆ flash_read_page()

flash_err_t flash_read_page ( flash_t * ctx,
uint32_t mem_addr,
uint8_t * data_rx,
uint16_t n_data )

Page Read function.

Parameters
ctxClick object.
mem_addrMemory address.
data_rxData which was read.
n_dataNumber of bytes to be read.
Returns
0x0 - Ok, 0xFE - Invalid memory address, 0xFF - Number of data bytes is out of range.

@description This function allows memory to be read up to 256 bytes, starting from the selected memory address.

◆ flash_read_status()

uint8_t flash_read_status ( flash_t * ctx)

Status Read function.

Parameters
ctxClick object.
Returns
Status byte.

@description This function reads Status register.

◆ flash_reset()

void flash_reset ( flash_t * ctx)

Reset function.

Parameters
ctxClick object.

@description This function is used as a system (software) reset that puts the device in normal operating Ready mode.

Note
This function will make a delay of 1 second.

◆ flash_set_hold_pin()

void flash_set_hold_pin ( flash_t * ctx,
flash_pin_state_t state )

HLD Pin Set function.

Parameters
ctxClick object.
stateThe desired pin state to be set. (active low)

@description This function sets the HLD pin to the desired state.

◆ flash_set_write_protect_pin()

void flash_set_write_protect_pin ( flash_t * ctx,
flash_pin_state_t state )

WP Pin Set function.

Parameters
ctxClick object.
stateThe desired pin state to be set. (active low)

@description This function sets the WP pin to the desired state.

◆ flash_write_byte()

flash_err_t flash_write_byte ( flash_t * ctx,
uint32_t mem_addr,
uint8_t data_tx )

Byte Write function.

Parameters
ctxClick object.
mem_addrMemory address.
data_txData to be written.
Returns
0x0 - Ok, 0xFE - Invalid memory address.

@description This function writes one byte data to the selected memory address.

Note
Write Enable Latch will be set automatically and reset after cycle was done.

◆ flash_write_disable()

void flash_write_disable ( flash_t * ctx)

Write Disable function.

Parameters
ctxClick object.

@description This function will reset the Write Enable Latch to protect the memory programming, status register writing and chip/sector erasing.

Note
This function also can be used to exit from OTP mode to normal mode.

◆ flash_write_enable()

void flash_write_enable ( flash_t * ctx)

Write Enable function.

Parameters
ctxClick object.

@description This function sets the Write Enable Latch to allow user to execute memory programming, status register writing and chip/sector erasing.

◆ flash_write_page()

flash_err_t flash_write_page ( flash_t * ctx,
uint32_t mem_addr,
uint8_t * data_tx,
uint16_t n_data )

Page Write function.

Parameters
ctxClick object.
mem_addrMemory address.
data_txData to be written.
n_dataNumber of bytes to be written.
Returns
0x0 - Ok, 0xFE - Invalid memory address, 0xFF - Number of data bytes is out of range.

@description This function allows memory to be programmed up to 256 bytes, starting from the selected memory address.

Note
Write Enable Latch will be set automatically and reset after cycle was done.

◆ flash_write_status()

void flash_write_status ( flash_t * ctx,
uint8_t data_tx )

Status Write function.

Parameters
ctxClick object.
data_txData to be written.

@description This function writes one byte to Status register.

Note
Write Enable Latch will be set automatically and reset after cycle was done.