mram 2.0.0.0
Public function

Functions

void mram_cfg_setup (mram_cfg_t *cfg)
 Config Object Initialization function.
 
err_t mram_init (mram_t *ctx, mram_cfg_t *cfg)
 Initialization function.
 
void mram_default_cfg (mram_t *ctx)
 Click Default Configuration function.
 
void mram_generic_transfer (mram_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
uint8_t mram_read_status_reg (mram_t *ctx)
 Read status reg.
 
uint8_t mram_check_status_bit (mram_t *ctx, uint8_t status_bit)
 Check status bit.
 
uint8_t mram_enable_write (mram_t *ctx)
 Enable write.
 
uint8_t mram_disable_write (mram_t *ctx)
 Disable write.
 
void mram_write_status_reg (mram_t *ctx, uint8_t transfer_data)
 Write status reg.
 
void mram_read_data_bytes (mram_t *ctx, const uint16_t address, uint8_t *buffer, const uint16_t n_bytes)
 Read n byte data.
 
void mram_write_data_bytes (mram_t *ctx, const uint16_t address, uint8_t *buffer, const uint16_t n_bytes)
 Write n byte data.
 
void mram_enter_sleep_mode (mram_t *ctx)
 Sleep mode.
 
void mram_wake_up_mode (mram_t *ctx)
 Wake up.
 
void mram_enable_write_protect (mram_t *ctx, uint8_t state)
 Enable write protection.
 
void mram_enable_hold_mode (mram_t *ctx, uint8_t state)
 Enable hold mode.
 

Detailed Description

Function Documentation

◆ mram_cfg_setup()

void mram_cfg_setup ( mram_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ mram_check_status_bit()

uint8_t mram_check_status_bit ( mram_t * ctx,
uint8_t status_bit )

Check status bit.

Parameters
ctxClick object.
status_bitBit to be checked.
Returns
0x01 or 0x00

Function return 0x01 or 0x00 depending on the status_bit.

◆ mram_default_cfg()

void mram_default_cfg ( mram_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

This function executes default configuration for MRAM click.

◆ mram_disable_write()

uint8_t mram_disable_write ( mram_t * ctx)

Disable write.

Parameters
ctxClick object.
Returns
If write is disabled.

Function disables write and returs if disabling was successful.

◆ mram_enable_hold_mode()

void mram_enable_hold_mode ( mram_t * ctx,
uint8_t state )

Enable hold mode.

Parameters
ctxClick object.
stateState to be changed for hold mode.

Function enables or disables hold mode.

◆ mram_enable_write()

uint8_t mram_enable_write ( mram_t * ctx)

Enable write.

Parameters
ctxClick object.
Returns
If write is enabled.

Function enables write and returs if enabling was successful.

◆ mram_enable_write_protect()

void mram_enable_write_protect ( mram_t * ctx,
uint8_t state )

Enable write protection.

Parameters
ctxClick object.
stateState to be changed for write protect.

Function enables or disables write protect.

◆ mram_enter_sleep_mode()

void mram_enter_sleep_mode ( mram_t * ctx)

Sleep mode.

Parameters
ctxClick object.

Function puts click board into sleep mode.

◆ mram_generic_transfer()

void mram_generic_transfer ( mram_t * ctx,
uint8_t * wr_buf,
uint16_t wr_len,
uint8_t * rd_buf,
uint16_t rd_len )

Generic transfer function.

Parameters
ctxClick object.
wr_bufWrite data buffer
wr_lenNumber of byte in write data buffer
rd_bufRead data buffer
rd_lenNumber of byte in read data buffer

Generic SPI transfer, for sending and receiving packages

◆ mram_init()

err_t mram_init ( mram_t * ctx,
mram_cfg_t * cfg )

Initialization function.

Parameters
mramClick object.
cfgClick configuration structure.

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

◆ mram_read_data_bytes()

void mram_read_data_bytes ( mram_t * ctx,
const uint16_t address,
uint8_t * buffer,
const uint16_t n_bytes )

Read n byte data.

Parameters
ctxClick object.
addressAdress.
bufferBuffer holding read data.
n_bytesNumber of bytes to be read.

Function reads n bytes of data and saves it in buffer.

◆ mram_read_status_reg()

uint8_t mram_read_status_reg ( mram_t * ctx)

Read status reg.

Parameters
ctxClick object.
Returns
Value of reg.

Function read status register.

◆ mram_wake_up_mode()

void mram_wake_up_mode ( mram_t * ctx)

Wake up.

Parameters
ctxClick object.

Function wakes up the click board.

◆ mram_write_data_bytes()

void mram_write_data_bytes ( mram_t * ctx,
const uint16_t address,
uint8_t * buffer,
const uint16_t n_bytes )

Write n byte data.

Parameters
ctxClick object.
addressAdress.
bufferBuffer holding data to be written.
n_bytesNumber of bytes to be written.

Function writes n bytes of data from the buffer.

◆ mram_write_status_reg()

void mram_write_status_reg ( mram_t * ctx,
uint8_t transfer_data )

Write status reg.

Parameters
ctxClick object.
transfer_dataData to be written.

Function writes data in status reg.