flash9 2.0.0.0
Flash 9 Click Driver

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

Topics

 Flash 9 Instructions List
 List of instructions of Flash 9 Click driver.
 
 Flash 9 Registers Settings
 Settings for registers of Flash 9 Click driver.
 
 Flash 9 MikroBUS Map
 MikroBUS pin mapping of Flash 9 Click driver.
 

Functions

void flash9_cfg_setup (flash9_cfg_t *cfg)
 Flash 9 configuration object setup function.
 
err_t flash9_init (flash9_t *ctx, flash9_cfg_t *cfg)
 Flash 9 initialization function.
 
err_t flash9_default_cfg (flash9_t *ctx)
 Flash 9 default configuration function.
 
err_t flash9_generic_write (flash9_t *ctx, uint8_t *data_in, uint16_t in_len)
 Flash 9 generic write function.
 
err_t flash9_generic_read (flash9_t *ctx, uint8_t *data_in, uint8_t in_len, uint8_t *data_out, uint16_t out_len)
 Flash 9 generic read function.
 
err_t flash9_write_register (flash9_t *ctx, uint8_t reg, uint8_t *data_in, uint16_t in_len)
 Flash 9 write register function.
 
err_t flash9_read_register (flash9_t *ctx, uint8_t reg, uint8_t *data_out, uint16_t out_len)
 Flash 9 read register function.
 
err_t flash9_write_command (flash9_t *ctx, uint8_t cmd)
 Flash 9 write command function.
 
void flash9_set_wp_pin (flash9_t *ctx, uint8_t state)
 Flash 9 set wp pin function.
 
void flash9_set_hld_pin (flash9_t *ctx, uint8_t state)
 Flash 9 set hld pin function.
 
void flash9_set_rst_pin (flash9_t *ctx, uint8_t state)
 Flash 9 set rst pin function.
 
err_t flash9_check_communication (flash9_t *ctx)
 Flash 9 check communication function.
 
err_t flash9_erase_memory (flash9_t *ctx, uint8_t erase_cmd, uint32_t address)
 Flash 9 erase memory function.
 
err_t flash9_read_status (flash9_t *ctx, uint8_t status_cmd, uint8_t *status)
 Flash 9 read status function.
 
err_t flash9_write_status (flash9_t *ctx, uint8_t status_cmd, uint8_t status)
 Flash 9 write status function.
 
err_t flash9_memory_write (flash9_t *ctx, uint32_t address, uint8_t *data_in, uint16_t len)
 Flash 9 memory write function.
 
err_t flash9_memory_read (flash9_t *ctx, uint32_t address, uint8_t *data_out, uint16_t len)
 Flash 9 memory read function.
 
err_t flash9_memory_read_fast (flash9_t *ctx, uint32_t address, uint8_t *data_out, uint16_t len)
 Flash 9 memory read fast function.
 

Detailed Description

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

◆ flash9_cfg_setup()

void flash9_cfg_setup ( flash9_cfg_t * cfg)

Flash 9 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ flash9_check_communication()

err_t flash9_check_communication ( flash9_t * ctx)

Flash 9 check communication function.

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

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

◆ flash9_default_cfg()

err_t flash9_default_cfg ( flash9_t * ctx)

Flash 9 default configuration function.

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

Parameters
[in]ctx: Click context object. See flash9_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.

◆ flash9_erase_memory()

err_t flash9_erase_memory ( flash9_t * ctx,
uint8_t erase_cmd,
uint32_t address )

Flash 9 erase memory function.

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

Parameters
[in]ctx: Click context object. See flash9_t object definition for detailed explanation.
[in]erase_cmd: Erase command (32-bit or 24-bit).
[in]address: The sector or block of memory that contains this address will be erased.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ flash9_generic_read()

err_t flash9_generic_read ( flash9_t * ctx,
uint8_t * data_in,
uint8_t in_len,
uint8_t * data_out,
uint16_t out_len )

Flash 9 generic read function.

This function writes and then reads a desired number of data bytes by using SPI serial interface.

Parameters
[in]ctx: Click context object. See flash9_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]in_len: Number of bytes to be written.
[out]data_out: Output read data.
[in]out_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ flash9_generic_write()

err_t flash9_generic_write ( flash9_t * ctx,
uint8_t * data_in,
uint16_t in_len )

Flash 9 generic write function.

This function writes a desired number of data bytes by using SPI serial interface.

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

◆ flash9_init()

err_t flash9_init ( flash9_t * ctx,
flash9_cfg_t * cfg )

Flash 9 initialization function.

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

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

◆ flash9_memory_read()

err_t flash9_memory_read ( flash9_t * ctx,
uint32_t address,
uint8_t * data_out,
uint16_t len )

Flash 9 memory read function.

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

Parameters
[in]ctx: Click context object. See flash9_t object definition for detailed explanation.
[in]address: Starting address (32-bit).
[in]data_out: Output data read.
[in]len: Number of data bytes.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ flash9_memory_read_fast()

err_t flash9_memory_read_fast ( flash9_t * ctx,
uint32_t address,
uint8_t * data_out,
uint16_t len )

Flash 9 memory read fast function.

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

Parameters
[in]ctx: Click context object. See flash9_t object definition for detailed explanation.
[in]address: Starting address (32-bit).
[in]data_out: Output data read.
[in]len: Number of data bytes.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ flash9_memory_write()

err_t flash9_memory_write ( flash9_t * ctx,
uint32_t address,
uint8_t * data_in,
uint16_t len )

Flash 9 memory write function.

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

Parameters
[in]ctx: Click context object. See flash9_t object definition for detailed explanation.
[in]address: Starting address (32-bit).
[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.

◆ flash9_read_register()

err_t flash9_read_register ( flash9_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint16_t out_len )

Flash 9 read register function.

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

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

◆ flash9_read_status()

err_t flash9_read_status ( flash9_t * ctx,
uint8_t status_cmd,
uint8_t * status )

Flash 9 read status function.

This function reads the selected status.

Parameters
[in]ctx: Click context object. See flash9_t object definition for detailed explanation.
[in]status_cmd: Status command.
[out]status: Status byte read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ flash9_set_hld_pin()

void flash9_set_hld_pin ( flash9_t * ctx,
uint8_t state )

Flash 9 set hld pin function.

This function sets the HLD pin logic state.

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

◆ flash9_set_rst_pin()

void flash9_set_rst_pin ( flash9_t * ctx,
uint8_t state )

Flash 9 set rst pin function.

This function sets the RST pin logic state.

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

◆ flash9_set_wp_pin()

void flash9_set_wp_pin ( flash9_t * ctx,
uint8_t state )

Flash 9 set wp pin function.

This function sets the WP pin logic state.

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

◆ flash9_write_command()

err_t flash9_write_command ( flash9_t * ctx,
uint8_t cmd )

Flash 9 write command function.

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

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

◆ flash9_write_register()

err_t flash9_write_register ( flash9_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint16_t in_len )

Flash 9 write register function.

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

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

◆ flash9_write_status()

err_t flash9_write_status ( flash9_t * ctx,
uint8_t status_cmd,
uint8_t status )

Flash 9 write status function.

This function writes the selected status.

Parameters
[in]ctx: Click context object. See flash9_t object definition for detailed explanation.
[in]status_cmd: Status command.
[in]status: Status byte to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.