fram6 2.0.0.0
FRAM 6 Click Driver

API for configuring and manipulating FRAM 6 Click driver. More...

Topics

 FRAM 6 Opcode Commands List
 List of Opcode Commands of FRAM 6 Click driver.
 
 FRAM 6 Registers Settings
 Settings for registers of FRAM 6 Click driver.
 
 FRAM 6 MikroBUS Map
 MikroBUS pin mapping of FRAM 6 Click driver.
 

Functions

void fram6_cfg_setup (fram6_cfg_t *cfg)
 FRAM 6 configuration object setup function.
 
err_t fram6_init (fram6_t *ctx, fram6_cfg_t *cfg)
 FRAM 6 initialization function.
 
err_t fram6_default_cfg (fram6_t *ctx)
 FRAM 6 default configuration function.
 
err_t fram6_write_opcode (fram6_t *ctx, uint8_t opcode)
 FRAM 6 write opcode function.
 
err_t fram6_read_opcode (fram6_t *ctx, uint8_t opcode, uint8_t *data_out, uint8_t len)
 FRAM 6 read opcode function.
 
err_t fram6_check_communication (fram6_t *ctx)
 FRAM 6 check communication function.
 
void fram6_set_wp_pin (fram6_t *ctx, uint8_t state)
 FRAM 6 set WP pin function.
 
void fram6_set_hld_pin (fram6_t *ctx, uint8_t state)
 FRAM 6 set HLD pin function.
 
err_t fram6_enable_write (fram6_t *ctx)
 FRAM 6 enable write function.
 
err_t fram6_disable_write (fram6_t *ctx)
 FRAM 6 disable write function.
 
err_t fram6_set_block_protection (fram6_t *ctx, uint8_t block_protect)
 FRAM 6 set block protection function.
 
err_t fram6_write_status (fram6_t *ctx, uint8_t status)
 FRAM 6 write status function.
 
err_t fram6_read_status (fram6_t *ctx, uint8_t *status)
 FRAM 6 read status function.
 
err_t fram6_enter_sleep_mode (fram6_t *ctx)
 FRAM 6 enter sleep mode function.
 
void fram6_wakeup_from_sleep (fram6_t *ctx)
 FRAM 6 wake up from sleep function.
 
err_t fram6_memory_write (fram6_t *ctx, uint32_t address, uint8_t *data_in, uint16_t len)
 FRAM 6 memory write function.
 
err_t fram6_memory_read (fram6_t *ctx, uint32_t address, uint8_t *data_out, uint16_t len)
 FRAM 6 memory read function.
 
err_t fram6_memory_read_fast (fram6_t *ctx, uint32_t address, uint8_t *data_out, uint16_t len)
 FRAM 6 memory read fast function.
 

Detailed Description

API for configuring and manipulating FRAM 6 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

◆ fram6_cfg_setup()

void fram6_cfg_setup ( fram6_cfg_t * cfg)

FRAM 6 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ fram6_check_communication()

err_t fram6_check_communication ( fram6_t * ctx)

FRAM 6 check communication function.

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

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

◆ fram6_default_cfg()

err_t fram6_default_cfg ( fram6_t * ctx)

FRAM 6 default configuration function.

This function executes a default configuration of FRAM 6 click board.

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

◆ fram6_disable_write()

err_t fram6_disable_write ( fram6_t * ctx)

FRAM 6 disable write function.

This function disables write by issuing the WRDI command and checking the WEL bit.

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

◆ fram6_enable_write()

err_t fram6_enable_write ( fram6_t * ctx)

FRAM 6 enable write function.

This function enables write by issuing the WREN command and checking the WEL bit.

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

◆ fram6_enter_sleep_mode()

err_t fram6_enter_sleep_mode ( fram6_t * ctx)

FRAM 6 enter sleep mode function.

This function enters to the sleep mode by issuing the SLEEP command.

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

◆ fram6_init()

err_t fram6_init ( fram6_t * ctx,
fram6_cfg_t * cfg )

FRAM 6 initialization function.

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

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

◆ fram6_memory_read()

err_t fram6_memory_read ( fram6_t * ctx,
uint32_t address,
uint8_t * data_out,
uint16_t len )

FRAM 6 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 fram6_t object definition for detailed explanation.
[in]address: Starting memory address [0x00000-0x3FFFF].
[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.

◆ fram6_memory_read_fast()

err_t fram6_memory_read_fast ( fram6_t * ctx,
uint32_t address,
uint8_t * data_out,
uint16_t len )

FRAM 6 memory read fast function.

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

Parameters
[in]ctx: Click context object. See fram6_t object definition for detailed explanation.
[in]address: Starting memory address [0x00000-0x3FFFF].
[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.

◆ fram6_memory_write()

err_t fram6_memory_write ( fram6_t * ctx,
uint32_t address,
uint8_t * data_in,
uint16_t len )

FRAM 6 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 fram6_t object definition for detailed explanation.
[in]address: Starting memory address [0x00000-0x3FFFF].
[in]data_in: Data to be written.
[in]len: Number of data bytes.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ fram6_read_opcode()

err_t fram6_read_opcode ( fram6_t * ctx,
uint8_t opcode,
uint8_t * data_out,
uint8_t len )

FRAM 6 read opcode function.

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

Parameters
[in]ctx: Click context object. See fram6_t object definition for detailed explanation.
[in]opcode: Opcode command.
[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.
Note
None.

◆ fram6_read_status()

err_t fram6_read_status ( fram6_t * ctx,
uint8_t * status )

FRAM 6 read status function.

This function reads the Status register.

Parameters
[in]ctx: Click context object. See fram6_t object definition for detailed explanation.
[out]status: Read data output.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ fram6_set_block_protection()

err_t fram6_set_block_protection ( fram6_t * ctx,
uint8_t block_protect )

FRAM 6 set block protection function.

This function sets the block protection bits of the Status register.

Parameters
[in]ctx: Click context object. See fram6_t object definition for detailed explanation.
[in]block_protect:
  • 0x00 - None,
  • 0x04 - Upper quarter,
  • 0x08 - Upper half,
  • 0x0C - All.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ fram6_set_hld_pin()

void fram6_set_hld_pin ( fram6_t * ctx,
uint8_t state )

FRAM 6 set HLD pin function.

This function sets the HOLD (HLD) pin logic state.

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

◆ fram6_set_wp_pin()

void fram6_set_wp_pin ( fram6_t * ctx,
uint8_t state )

FRAM 6 set WP pin function.

This function sets the Write Protect (WP) pin logic state.

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

◆ fram6_wakeup_from_sleep()

void fram6_wakeup_from_sleep ( fram6_t * ctx)

FRAM 6 wake up from sleep function.

This function wakes up from sleep mode by toggling the CS pin.

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

◆ fram6_write_opcode()

err_t fram6_write_opcode ( fram6_t * ctx,
uint8_t opcode )

FRAM 6 write opcode function.

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

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

◆ fram6_write_status()

err_t fram6_write_status ( fram6_t * ctx,
uint8_t status )

FRAM 6 write status function.

This function writes a desired data to the Status register.

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