mram 2.0.0.0
mram.h File Reference

This file contains API for MRAM Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  mram_t
 Click ctx object definition. More...
 
struct  mram_cfg_t
 Click configuration structure definition. More...
 

Macros

#define MRAM_MAP_MIKROBUS(cfg, mikrobus)
 
#define MRAM_OK   0
 
#define MRAM_ERROR   -1
 
#define MRAM_WRITE_ENABLE_BIT   0x02
 
#define MRAM_MEMORY_BLOCK_BIT0   0x04
 
#define MRAM_MEMORY_BLOCK_BIT1   0x08
 
#define MRAM_STATUS_WRITE_DISABLE_BIT   0x80
 
#define MRAM_FIRST_ADDRESS_LOCATION   0x0000
 
#define MRAM_ADDRESS_LOCATION_0   0x000F
 
#define MRAM_ADDRESS_LOCATION_1   0x00FF
 
#define MRAM_ADDRESS_LOCATION_2   0x0FFF
 
#define MRAM_LAST_ADDRESS_LOCATION   0x7FFF
 
#define MRAM_LOGIC_HIGH   0x01
 
#define MRAM_LOGIC_LOW   0x00
 
#define MRAM_NONE_PROTECTED_MEMORY   0x82
 
#define MRAM_UPPER_QUARTER_PROTECTED_MEMORY   0x86
 
#define MRAM_UPPER_HALF_PROTECTED_MEMORY   0x8A
 
#define MRAM_ALL_PROTECTED_MEMORY   0x8E
 

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

This file contains API for MRAM Click driver.