flash7 2.0.0.0
Flash 7 Click Driver

API for configuring and manipulating Flash 7 Click driver. More...

Topics

 Flash 7 Registers List
 List of registers of Flash 7 Click driver.
 
 Flash 7 Registers Settings
 Settings for registers of Flash 7 Click driver.
 
 Flash 7 MikroBUS Map
 MikroBUS pin mapping of Flash 7 Click driver.
 

Functions

void flash7_cfg_setup (flash7_cfg_t *cfg)
 Flash 7 configuration object setup function.
 
err_t flash7_init (flash7_t *ctx, flash7_cfg_t *cfg)
 Flash 7 initialization function.
 
err_t flash7_default_cfg (flash7_t *ctx)
 Flash 7 default configuration function.
 
err_t flash7_generic_write (flash7_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Flash 7 data writing 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_write_protect (flash7_t *ctx, uint8_t en_write_protect)
 Enable write protect 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.
 
void flash7_write_enable (flash7_t *ctx)
 Write enable function.
 
void flash7_write_disable (flash7_t *ctx)
 Write disable function.
 
void flash7_chip_erase (flash7_t *ctx)
 Chip erase function.
 
uint8_t flash7_read_status_register (flash7_t *ctx, uint8_t status_byte)
 Read status register function.
 
void flash7_write_status_register (flash7_t *ctx, uint16_t status_data)
 Write status register 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_read_memory (flash7_t *ctx, uint32_t mem_addr, uint8_t *p_rx_data, uint16_t n_bytes)
 Read memory 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.
 
uint8_t flash7_sector_erase (flash7_t *ctx, uint16_t mem_sector)
 Sector erase function.
 
uint8_t flash7_block_erase (flash7_t *ctx, uint8_t mem_block, uint8_t mem_block_len)
 Block erase function.
 
void flash7_go_to_sleep (flash7_t *ctx)
 Go to sleep mode function.
 
uint8_t flash7_wake_up (flash7_t *ctx)
 Wake up function.
 
void flash7_read_id (flash7_t *ctx, uint8_t *manufacturer_id, uint8_t *device_id)
 Read ID 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_sw_reset (flash7_t *ctx)
 Soft reset function.
 

Detailed Description

API for configuring and manipulating Flash 7 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ flash7_block_erase()

uint8_t flash7_block_erase ( flash7_t * ctx,
uint8_t mem_block,
uint8_t mem_block_len )

Block erase function.

This function performs erase of all data with the range depending on block length in the chosen block of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]mem_block: Number of block in memory for complete erase ( from 1 to 32 or 64 , depending on mem_block_len ).
mem_block_len: Sets the block erase length ( 32kb or 64kb ).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ flash7_cfg_setup()

void flash7_cfg_setup ( flash7_cfg_t * cfg)

Flash 7 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See flash7_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ flash7_chip_erase()

void flash7_chip_erase ( flash7_t * ctx)

Chip erase function.

The function sends chip erase command to the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
Returns
Nothing.

◆ flash7_default_cfg()

err_t flash7_default_cfg ( flash7_t * ctx)

Flash 7 default configuration function.

This function executes a default configuration of Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ flash7_fast_read_memory()

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.

The function reads a sequential data starting from the targeted 24-bit register address of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]mem_addr: 24-bit start memory address.
[out]p_rx_data: Pointer to the memory location where data is stored.
[in]n_bytes: 16-bit number of bytes to be read.
Returns
Nothing.

◆ flash7_generic_read()

err_t flash7_generic_read ( flash7_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Flash 7 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See flash7_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ flash7_generic_write()

err_t flash7_generic_write ( flash7_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Flash 7 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See flash7_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ flash7_get_identification()

void flash7_get_identification ( flash7_t * ctx,
uint8_t * manufacturer_id,
uint8_t * memory_type_id,
uint8_t * capacity_id )

Get identification function.

The function acquries identification data of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[out]manufacturer_id: Pointer to the memory location where the manufacturer ID is stored.
[out]memory_type_id: Pointer to the memory location where the memory type ID is stored.
[out]capacity_id: Pointer to the memory location where device ID is stored.
Returns
Nothing.

◆ flash7_go_to_sleep()

void flash7_go_to_sleep ( flash7_t * ctx)

Go to sleep mode function.

The function go to sleep is the only way to put the device in the lowest consumption mode, executing the Deep Power-Down of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
Returns
Nothing.

◆ flash7_hold()

void flash7_hold ( flash7_t * ctx,
uint8_t en_hold )

Enable hold operation function.

The function enable hold operation by sets the states of the IO3 ( INT ) pin depending on the function argument.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]en_hold: Resume or pause any serial communications with the device.
Returns
Nothing.

◆ flash7_init()

err_t flash7_init ( flash7_t * ctx,
flash7_cfg_t * cfg )

Flash 7 initialization function.

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

Parameters
[out]ctx: Click context object. See flash7_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See flash7_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ flash7_page_program()

uint8_t flash7_page_program ( flash7_t * ctx,
uint32_t mem_addr,
uint8_t * p_tx_data,
uint16_t n_bytes )

Page program function.

The function writes a sequential data starting from the targeted 24-bit register address of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]mem_addr: 24-bit start memory address.
[out]p_tx_data: Pointer to the data to be written.
[in]n_bytes: 16-bit number of bytes to be written.
Returns
8-bit status.

◆ flash7_read_id()

void flash7_read_id ( flash7_t * ctx,
uint8_t * manufacturer_id,
uint8_t * device_id )

Read ID function.

The function acquries manufacturer and device ID of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[out]manufacturer_id: Pointer to the memory location where the manufacturer ID is stored.
[out]device_id: Pointer to the memory location where device ID is stored.
Returns
Nothing.

◆ flash7_read_memory()

void flash7_read_memory ( flash7_t * ctx,
uint32_t mem_addr,
uint8_t * p_rx_data,
uint16_t n_bytes )

Read memory function.

The function reads a sequential data starting from the targeted 24-bit register address of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]mem_addr: 24-bit start memory address.
[out]p_rx_data: Pointer to the memory location where data is stored.
[in]n_bytes: 16-bit number of bytes to be read.
Returns
Nothing.

◆ flash7_read_status_register()

uint8_t flash7_read_status_register ( flash7_t * ctx,
uint8_t status_byte )

Read status register function.

The function reads status byte of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]status_byte: Read LSB or MSB status register.
Returns
8-bit status.

◆ flash7_sector_erase()

uint8_t flash7_sector_erase ( flash7_t * ctx,
uint16_t mem_sector )

Sector erase function.

This function performs erase of all data in the chosen sector of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
mem_sectornumber of sector in memory ( from 1 to 512 )
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ flash7_send_command()

void flash7_send_command ( flash7_t * ctx,
uint8_t cmd )

Send command function.

The function sends the desired command to the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]cmd: 8-bit commands instruction.
Returns
Nothing.

◆ flash7_sw_reset()

void flash7_sw_reset ( flash7_t * ctx)

Soft reset function.

The function performs a software reset of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
Returns
Nothing.

◆ flash7_wake_up()

uint8_t flash7_wake_up ( flash7_t * ctx)

Wake up function.

The function performs wake up, release from power-down and read device ID of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
Returns
8-bit device ID.

◆ flash7_write_disable()

void flash7_write_disable ( flash7_t * ctx)

Write disable function.

The function sends disable write command to the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
Returns
Nothing.

◆ flash7_write_enable()

void flash7_write_enable ( flash7_t * ctx)

Write enable function.

The function sends enable write command to the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
Returns
Nothing.

◆ flash7_write_protect()

void flash7_write_protect ( flash7_t * ctx,
uint8_t en_write_protect )

Enable write protect function.

The function enables write protect, by sets the states of the IO2 ( PWM ) pin depending on the function argument.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]en_write_protect: Write protection on or off.
Returns
Nothing.

◆ flash7_write_status_register()

void flash7_write_status_register ( flash7_t * ctx,
uint16_t status_data )

Write status register function.

The function writes status data of the GD25LQ16C 1.8V Uniform Sector Dual and Quad Serial Flash on Flash 7 click board.

Parameters
[in]ctx: Click context object. See flash7_cfg_t object definition for detailed explanation.
[in]status_data: 16-bit write status data.
Returns
Nothing.