LibDriver MB85RSXX
Loading...
Searching...
No Matches
mb85rsxx base driver function

mb85rsxx base driver modules More...

Collaboration diagram for mb85rsxx base driver function:

Data Structures

struct  mb85rsxx_handle_s
 mb85rsxx handle structure definition More...
struct  mb85rsxx_info_s
 mb85rsxx information structure definition More...

Macros

#define MB85RSXX_USE_DEVICE_ID   1
 mb85rsxx use device id definition

Typedefs

typedef struct mb85rsxx_handle_s mb85rsxx_handle_t
 mb85rsxx handle structure definition
typedef struct mb85rsxx_info_s mb85rsxx_info_t
 mb85rsxx information structure definition

Enumerations

enum  mb85rsxx_t {
  MB85RS16 = 2048 , MB85RS64 = 8192 , MB85RS128 = 16384 , MB85RS256 = 32768 ,
  MB85RS512 = 65536 , MB85RS1M = 131072 , MB85RS2M = 262144 , MB85RS4M = 524288
}
 mb85rsxx type enumeration definition More...
enum  mb85rsxx_status_t { MB85RSXX_STATUS_WPEN = (1 << 7) , MB85RSXX_STATUS_BP1 = (1 << 3) , MB85RSXX_STATUS_BP0 = (1 << 2) , MB85RSXX_STATUS_WEL = (1 << 1) }
 mb85rsxx status enumeration definition More...

Functions

uint8_t mb85rsxx_info (mb85rsxx_info_t *info)
 get chip's information
uint8_t mb85rsxx_init (mb85rsxx_handle_t *handle)
 initialize the chip
uint8_t mb85rsxx_deinit (mb85rsxx_handle_t *handle)
 close the chip
uint8_t mb85rsxx_set_type (mb85rsxx_handle_t *handle, mb85rsxx_t type)
 set the chip type
uint8_t mb85rsxx_get_type (mb85rsxx_handle_t *handle, mb85rsxx_t *type)
 get the chip type
uint8_t mb85rsxx_read (mb85rsxx_handle_t *handle, uint32_t address, uint8_t *buf, uint16_t len)
 read bytes from the chip
uint8_t mb85rsxx_write (mb85rsxx_handle_t *handle, uint32_t address, uint8_t *buf, uint16_t len)
 write bytes to the chip
uint8_t mb85rsxx_enable_write (mb85rsxx_handle_t *handle)
 enable write
uint8_t mb85rsxx_disable_write (mb85rsxx_handle_t *handle)
 disable write
uint8_t mb85rsxx_set_status (mb85rsxx_handle_t *handle, uint8_t status)
 set status
uint8_t mb85rsxx_get_status (mb85rsxx_handle_t *handle, uint8_t *status)
 get status
uint8_t mb85rsxx_get_device_id (mb85rsxx_handle_t *handle, uint8_t *manufacturer_id, uint8_t *continuation_code, uint8_t *product_id1, uint8_t *product_id2)
 get device id

Detailed Description

mb85rsxx base driver modules

Macro Definition Documentation

◆ MB85RSXX_USE_DEVICE_ID

#define MB85RSXX_USE_DEVICE_ID   1

mb85rsxx use device id definition

some types of chip can't use device id function and set this definition to 0 to skip device id checking. default setting is enable

Definition at line 63 of file driver_mb85rsxx.h.

Typedef Documentation

◆ mb85rsxx_handle_t

mb85rsxx handle structure definition

◆ mb85rsxx_info_t

mb85rsxx information structure definition

Enumeration Type Documentation

◆ mb85rsxx_status_t

mb85rsxx status enumeration definition

Enumerator
MB85RSXX_STATUS_WPEN 

status register write protect

MB85RSXX_STATUS_BP1 

block protect 1

MB85RSXX_STATUS_BP0 

block protect 0

MB85RSXX_STATUS_WEL 

write enable latch

Definition at line 86 of file driver_mb85rsxx.h.

◆ mb85rsxx_t

enum mb85rsxx_t

mb85rsxx type enumeration definition

Enumerator
MB85RS16 

MB85RS16 type

MB85RS64 

MB85RS64 type

MB85RS128 

MB85RS128 type

MB85RS256 

MB85RS256 type

MB85RS512 

MB85RS512 type

MB85RS1M 

MB85RS1M type

MB85RS2M 

MB85RS2M type

MB85RS4M 

MB85RS4M type

Definition at line 71 of file driver_mb85rsxx.h.

Function Documentation

◆ mb85rsxx_deinit()

uint8_t mb85rsxx_deinit ( mb85rsxx_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a mb85rsxx handle structure
Returns
status code
  • 0 success
  • 1 spi deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 333 of file driver_mb85rsxx.c.

◆ mb85rsxx_disable_write()

uint8_t mb85rsxx_disable_write ( mb85rsxx_handle_t * handle)

disable write

Parameters
[in]*handlepointer to a mb85rsxx handle structure
Returns
status code
  • 0 success
  • 1 disable write failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 108 of file driver_mb85rsxx.c.

◆ mb85rsxx_enable_write()

uint8_t mb85rsxx_enable_write ( mb85rsxx_handle_t * handle)

enable write

Parameters
[in]*handlepointer to a mb85rsxx handle structure
Returns
status code
  • 0 success
  • 1 enable write failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 72 of file driver_mb85rsxx.c.

◆ mb85rsxx_get_device_id()

uint8_t mb85rsxx_get_device_id ( mb85rsxx_handle_t * handle,
uint8_t * manufacturer_id,
uint8_t * continuation_code,
uint8_t * product_id1,
uint8_t * product_id2 )

get device id

Parameters
[in]*handlepointer to a mb85rsxx handle structure
[out]*manufacturer_idpointer to a manufacturer id buffer
[out]*continuation_codepointer to a continuation code buffer
[out]*product_id1pointer to a product id1 buffer
[out]*product_id2pointer to a product id2 buffer
Returns
status code
  • 0 success
  • 1 get device id failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 568 of file driver_mb85rsxx.c.

◆ mb85rsxx_get_status()

uint8_t mb85rsxx_get_status ( mb85rsxx_handle_t * handle,
uint8_t * status )

get status

Parameters
[in]*handlepointer to a mb85rsxx handle structure
[out]*statuspointer to a status buffer
Returns
status code
  • 0 success
  • 1 get status failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 145 of file driver_mb85rsxx.c.

◆ mb85rsxx_get_type()

uint8_t mb85rsxx_get_type ( mb85rsxx_handle_t * handle,
mb85rsxx_t * type )

get the chip type

Parameters
[in]*handlepointer to a mb85rsxx handle structure
[out]*typepointer to a chip type buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 385 of file driver_mb85rsxx.c.

◆ mb85rsxx_info()

uint8_t mb85rsxx_info ( mb85rsxx_info_t * info)

get chip's information

Parameters
[out]*infopointer to a mb85rsxx info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 623 of file driver_mb85rsxx.c.

◆ mb85rsxx_init()

uint8_t mb85rsxx_init ( mb85rsxx_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a mb85rsxx handle structure
Returns
status code
  • 0 success
  • 1 spi initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 id is invalid
Note
none

Definition at line 238 of file driver_mb85rsxx.c.

◆ mb85rsxx_read()

uint8_t mb85rsxx_read ( mb85rsxx_handle_t * handle,
uint32_t address,
uint8_t * buf,
uint16_t len )

read bytes from the chip

Parameters
[in]*handlepointer to a mb85rsxx handle structure
[in]addressregister address
[out]*bufpointer to a data buffer
[in]lenbuffer length
Returns
status code
  • 0 success
  • 1 read data failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 end address is over the max address
Note
none

Definition at line 411 of file driver_mb85rsxx.c.

◆ mb85rsxx_set_status()

uint8_t mb85rsxx_set_status ( mb85rsxx_handle_t * handle,
uint8_t status )

set status

Parameters
[in]*handlepointer to a mb85rsxx handle structure
[in]statusset status
Returns
status code
  • 0 success
  • 1 set status failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 182 of file driver_mb85rsxx.c.

◆ mb85rsxx_set_type()

uint8_t mb85rsxx_set_type ( mb85rsxx_handle_t * handle,
mb85rsxx_t type )

set the chip type

Parameters
[in]*handlepointer to a mb85rsxx handle structure
[in]typechip type
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 364 of file driver_mb85rsxx.c.

◆ mb85rsxx_write()

uint8_t mb85rsxx_write ( mb85rsxx_handle_t * handle,
uint32_t address,
uint8_t * buf,
uint16_t len )

write bytes to the chip

Parameters
[in]*handlepointer to a mb85rsxx handle structure
[in]addressregister address
[in]*bufpointer to a data buffer
[in]lenbuffer length
Returns
status code
  • 0 success
  • 1 write data failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 end address is over the max address
  • 5 len > 512
Note
none

Definition at line 477 of file driver_mb85rsxx.c.