Functions for accessing M24SR device.

Dependents:   Nucleo_NFC_Example I2C_NFC_Master Print_Entire_Nucleo_NFC01A1_Memory

Fork of lib_M24SR by Enrico Gregoratto

Embed: (wiki syntax)

« Back to documentation index

LibM24SR_Public_Functions

LibM24SR_Public_Functions
[Lib_M24SR]

Functions

uint16_t M24SR_Initialization (uint8_t *CCBuffer, uint8_t size)
 This fonction initialize the M24SR.
uint16_t M24SR_GetNDEFFileId (uint16_t *NDEF_fileID)
 This fonction retrieve the NDEF file ID of NDEF file present in M24SR.
uint16_t M24SR_OpenNDEFSession (uint16_t NDEF_fileID, uint16_t Priority)
 This fonction configure the M24SR to access NDEF message by I2C.
uint16_t M24SR_CloseNDEFSession (uint16_t NDEF_fileID)
 This fonction close the NDEF Session.
uint16_t M24SR_ReadData (uint16_t Offset, uint16_t DataSize, uint8_t *pData)
 This fonction read the data stored in M24SR at defined offset.
uint16_t M24SR_ForceReadData (uint16_t Offset, uint16_t DataSize, uint8_t *pData)
 This fonction read the data stored in M24SR at defined offset without NDEF concideration.
uint16_t M24SR_WriteData (uint16_t Offset, uint16_t DataSize, uint8_t *pData)
 This fonction write data in M24SR at defined offset.
uint16_t M24SR_EnableReadPassword (uint8_t *pCurrentWritePassword, uint8_t *pNewPassword)
 This fonction activate the need of a password for next read access.
uint16_t M24SR_DisableReadPassword (uint8_t *pCurrentWritePassword)
 This fonction desactivate the need of a password for next read access.
uint16_t M24SR_EnableWritePassword (uint8_t *pCurrentWritePassword, uint8_t *pNewPassword)
 This fonction activate the need of a password for next write access.
uint16_t M24SR_DisableWritePassword (uint8_t *pCurrentWritePassword)
 This fonction desactivate the need of a password for next write access.
uint16_t M24SR_DisableAllPassword (uint8_t *pSuperUserPassword)
 This fonction desactivate the need of read and write password for next access.
uint16_t M24SR_EnableReadOnly (uint8_t *pCurrentWritePassword)
 This fonction enable read only mode.
uint16_t M24SR_DisableReadOnly (uint8_t *pCurrentWritePassword)
 This fonction disable read only mode.
uint16_t M24SR_EnableWriteOnly (uint8_t *pCurrentWritePassword)
 This fonction enable write only mode.
uint16_t M24SR_DisableWriteOnly (uint8_t *pCurrentWritePassword)
 This fonction disable write only mode.
uint16_t M24SR_ManageGPO (uc8 GPO_config, uc8 mode)
 This function configure GPO purpose for RF session.

Function Documentation

uint16_t M24SR_CloseNDEFSession ( uint16_t  NDEF_fileID )

This fonction close the NDEF Session.

Parameters:
NDEF_fileID: NDEF identification to select NDEF in M24SR
Return values:
SUCCESS: Session is closed
ERROR: Not able to close session.

Definition at line 222 of file lib_M24SR.c.

uint16_t M24SR_DisableAllPassword ( uint8_t *  pSuperUserPassword )

This fonction desactivate the need of read and write password for next access.

Parameters:
pSuperUserPassword: I2C super user password to overwrite read and write password
Return values:
SUCCESS: M24SR access is now free (no password needed)
ERROR: operation does not complete

Definition at line 439 of file lib_M24SR.c.

uint16_t M24SR_DisableReadOnly ( uint8_t *  pCurrentWritePassword )

This fonction disable read only mode.

Parameters:
pCurrentWritePassword: Write password is needed to have right to disable read only mode
Return values:
SUCCESS: M24SR write access is now allowed
ERROR: operation does not complete

Definition at line 495 of file lib_M24SR.c.

uint16_t M24SR_DisableReadPassword ( uint8_t *  pCurrentWritePassword )

This fonction desactivate the need of a password for next read access.

Parameters:
pCurrentWritePassword: Write password is needed to have the right to disable Read Password
Return values:
SUCCESS: Read password is desactivated
ERROR: operation does not complete

Definition at line 363 of file lib_M24SR.c.

uint16_t M24SR_DisableWriteOnly ( uint8_t *  pCurrentWritePassword )

This fonction disable write only mode.

Parameters:
pCurrentWritePassword: Write password is needed to have right to disable write only mode
Return values:
SUCCESS: M24SR read access is now allowed
ERROR: operation does not complete

Definition at line 544 of file lib_M24SR.c.

uint16_t M24SR_DisableWritePassword ( uint8_t *  pCurrentWritePassword )

This fonction desactivate the need of a password for next write access.

Parameters:
pCurrentWritePassword: Write password must be prensented to have the right to disable it
Return values:
SUCCESS: Write password is desactivated
ERROR: operation does not complete

Definition at line 415 of file lib_M24SR.c.

uint16_t M24SR_EnableReadOnly ( uint8_t *  pCurrentWritePassword )

This fonction enable read only mode.

Parameters:
pCurrentWritePassword: Write password is needed to have right to enable read only mode
Return values:
SUCCESS: M24SR access is now forbidden in write mode
ERROR: operation does not complete

Definition at line 471 of file lib_M24SR.c.

uint16_t M24SR_EnableReadPassword ( uint8_t *  pCurrentWritePassword,
uint8_t *  pNewPassword 
)

This fonction activate the need of a password for next read access.

Parameters:
pCurrentWritePassword: Write password is needed to have the right to enable Read Password
pNewPassword: The password that will be requiered for next read access
Return values:
SUCCESS: Read password is activated
ERROR: operation does not complete

Definition at line 337 of file lib_M24SR.c.

uint16_t M24SR_EnableWriteOnly ( uint8_t *  pCurrentWritePassword )

This fonction enable write only mode.

Parameters:
pCurrentWritePassword: Write password is needed to have right to enable write only mode
Return values:
SUCCESS: M24SR access is now forbidden in read mode
ERROR: operation does not complete

Definition at line 520 of file lib_M24SR.c.

uint16_t M24SR_EnableWritePassword ( uint8_t *  pCurrentWritePassword,
uint8_t *  pNewPassword 
)

This fonction activate the need of a password for next write access.

Parameters:
pCurrentWritePassword: Write password must be prensented to have the right to modify write Password
pNewPassword: The password that will be requiered for next write access
Return values:
SUCCESS: Write password is activated
ERROR: operation does not complete

Definition at line 389 of file lib_M24SR.c.

uint16_t M24SR_ForceReadData ( uint16_t  Offset,
uint16_t  DataSize,
uint8_t *  pData 
)

This fonction read the data stored in M24SR at defined offset without NDEF concideration.

Parameters:
Offset: Offset in the NDEF file in M24SR
DataSize: Number of byte to read
pData: pointer on buffer to store read data
Return values:
Status(SW1&SW2) : Status of the operation.

Definition at line 279 of file lib_M24SR.c.

uint16_t M24SR_GetNDEFFileId ( uint16_t *  NDEF_fileID )

This fonction retrieve the NDEF file ID of NDEF file present in M24SR.

Parameters:
NDEF_fileID: To store NDEF ID
Return values:
SUCCESS: File ID read
ERROR: Not able to read file ID.

Definition at line 141 of file lib_M24SR.c.

uint16_t M24SR_Initialization ( uint8_t *  CCBuffer,
uint8_t  size 
)

This fonction initialize the M24SR.

Parameters:
CCBuffer: pointer on the buffer to store CC file
size: number of byte of data to read
Return values:
SUCCESS: Initalization done
ERROR: Not able to Initialize.

Definition at line 86 of file lib_M24SR.c.

uint16_t M24SR_ManageGPO ( uc8  GPO_config,
uc8  mode 
)

This function configure GPO purpose for RF session.

Parameters:
GPO_config,:GPO configuration to set
mode,:select RF or I2C, GPO config to update
Return values:
Status: Status of the operation.

Definition at line 569 of file lib_M24SR.c.

uint16_t M24SR_OpenNDEFSession ( uint16_t  NDEF_fileID,
uint16_t  Priority 
)

This fonction configure the M24SR to access NDEF message by I2C.

Parameters:
NDEF_fileID: NDEF identification to select NDEF in M24SR
Priority,:2 options: check if M24SR available to open session (no RF session on going) Kill RF session and open I2C sesssion.
Return values:
SUCCESS: Session is opened
ERROR: Not able to open session.

Definition at line 163 of file lib_M24SR.c.

uint16_t M24SR_ReadData ( uint16_t  Offset,
uint16_t  DataSize,
uint8_t *  pData 
)

This fonction read the data stored in M24SR at defined offset.

Parameters:
Offset: Offset in the NDEF file in M24SR
DataSize: Number of byte to read
pData: pointer on buffer to store read data
Return values:
Status(SW1&SW2) : Status of the operation.

Definition at line 250 of file lib_M24SR.c.

uint16_t M24SR_WriteData ( uint16_t  Offset,
uint16_t  DataSize,
uint8_t *  pData 
)

This fonction write data in M24SR at defined offset.

Parameters:
Offset: Offset in the NDEF file in M24SR
DataSize: Number of byte to read
pData: pointer on buffer to copy in M24SR
Return values:
Status(SW1&SW2) : Status of the operation.

Definition at line 308 of file lib_M24SR.c.