flash10 2.1.0.0
Flash 10 Click Driver

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

Topics

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

Functions

void flash10_cfg_setup (flash10_cfg_t *cfg)
 Flash 10 configuration object setup function.
 
err_t flash10_init (flash10_t *ctx, flash10_cfg_t *cfg)
 Flash 10 initialization function.
 
err_t flash10_write_cmd (flash10_t *ctx, uint8_t cmd)
 Flash 10 write cmd 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_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.
 
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_memory_write (flash10_t *ctx, uint32_t address, uint8_t *data_in, uint32_t len)
 Flash 10 memory write 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_erase_memory (flash10_t *ctx, uint8_t erase_cmd, uint32_t address)
 Flash 10 erase memory function.
 
err_t flash10_check_communication (flash10_t *ctx)
 Flash 10 check communication function.
 
err_t flash10_write_protect (flash10_t *ctx)
 Flash 10 write protect function.
 
err_t flash10_write_enable (flash10_t *ctx)
 Flash 10 write enable function.
 
err_t flash10_soft_reset (flash10_t *ctx)
 Flash 10 soft reset 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_read_status (flash10_t *ctx, uint8_t status_reg_num, uint8_t *status)
 Flash 10 read status function.
 
void flash10_set_wp_pin (flash10_t *ctx, uint8_t state)
 Flash 10 set wp pin function.
 
void flash10_set_rst_pin (flash10_t *ctx, uint8_t state)
 Flash 10 set rst pin function.
 

Detailed Description

API for configuring and manipulating Flash 10 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

◆ flash10_cfg_setup()

void flash10_cfg_setup ( flash10_cfg_t * cfg)

Flash 10 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ flash10_check_communication()

err_t flash10_check_communication ( flash10_t * ctx)

Flash 10 check communication function.

This function checks the communication by reading and verifying the device ID.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_erase_memory()

err_t flash10_erase_memory ( flash10_t * ctx,
uint8_t erase_cmd,
uint32_t address )

Flash 10 erase memory function.

This function erases the selected amount of memory which contains the selected address.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]erase_cmd: Erase command.
[in]address: The block of memory that contains this address will be erased. Ignored for FLASH10_CMD_CHIP_ERASE command.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_init()

err_t flash10_init ( flash10_t * ctx,
flash10_cfg_t * cfg )

Flash 10 initialization function.

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

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

◆ flash10_memory_read()

err_t flash10_memory_read ( flash10_t * ctx,
uint32_t address,
uint8_t * data_out,
uint32_t len )

Flash 10 memory read function.

This function reads a desired number of data bytes starting from the selected memory address.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]address: Starting memory address [0x00000-0x3FFFFF].
[out]data_out: Read data output.
[in]len: Number of data bytes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_memory_write()

err_t flash10_memory_write ( flash10_t * ctx,
uint32_t address,
uint8_t * data_in,
uint32_t len )

Flash 10 memory write function.

This function writes a desired number of data bytes starting from the selected memory address.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]address: Starting memory address [0x00000-0x3FFFFF].
[in]data_in: Data to be written.
[in]len: Number of data bytes (up to 256).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_read_cmd_address_data()

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.

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

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]cmd: Command byte.
[in]address: Memory address (up to 0x3FFFFF).
[out]data_out: Output read data.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_read_cmd_data()

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.

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

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]cmd: Command byte.
[out]data_out: Output read data.
[in]len: Number of bytes to be read (up to 8).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_read_status()

err_t flash10_read_status ( flash10_t * ctx,
uint8_t status_reg_num,
uint8_t * status )

Flash 10 read status function.

This function reads data from the selected status register.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]status_reg_num: Status register number (1-5).
[out]status: Status data read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_set_rst_pin()

void flash10_set_rst_pin ( flash10_t * ctx,
uint8_t state )

Flash 10 set rst pin function.

This function sets the RST pin logic state.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ flash10_set_wp_pin()

void flash10_set_wp_pin ( flash10_t * ctx,
uint8_t state )

Flash 10 set wp pin function.

This function sets the WP pin logic state.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ flash10_soft_reset()

err_t flash10_soft_reset ( flash10_t * ctx)

Flash 10 soft reset function.

This function executes the soft reset command.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_write_cmd()

err_t flash10_write_cmd ( flash10_t * ctx,
uint8_t cmd )

Flash 10 write cmd function.

This function writes a desired command by using SPI serial interface.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]cmd: Command byte.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_write_cmd_address_data()

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 function writes a desired number of data bytes starting from a desired address of the selected command by using SPI serial interface.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]cmd: Command byte.
[in]address: Memory address (up to 0x3FFFFF).
[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.

◆ flash10_write_cmd_data()

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.

This function writes a desired number of data bytes to the selected command by using SPI serial interface.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]cmd: Command byte.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written (up to 8).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash10_write_enable()

err_t flash10_write_enable ( flash10_t * ctx)

Flash 10 write enable function.

This function disables memory write-protect via the WP pin and WRITE ENABLE command.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ flash10_write_protect()

err_t flash10_write_protect ( flash10_t * ctx)

Flash 10 write protect function.

This function write protects the entire memory via the WP pin and WRITE DISABLE command.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ flash10_write_status()

err_t flash10_write_status ( flash10_t * ctx,
uint8_t status_reg_num,
uint8_t status )

Flash 10 write status function.

This function writes data to the selected status register.

Parameters
[in]ctx: Click context object. See flash10_t object definition for detailed explanation.
[in]status_reg_num: Status register number (1-5).
[in]status: Status data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.