Functions for accessing M24SR device.
Dependents: Nucleo_NFC_Example I2C_NFC_Master Print_Entire_Nucleo_NFC01A1_Memory
Fork of lib_M24SR by
Warning: Deprecated!
Supported drivers and applications can be found at this link.
lib_M24SR.h@0:ffc2448b65ef, 2014-12-15 (annotated)
- Committer:
- EnricoG
- Date:
- Mon Dec 15 19:41:52 2014 +0000
- Revision:
- 0:ffc2448b65ef
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EnricoG | 0:ffc2448b65ef | 1 | /** |
EnricoG | 0:ffc2448b65ef | 2 | ****************************************************************************** |
EnricoG | 0:ffc2448b65ef | 3 | * @file lib_M24SR.h |
EnricoG | 0:ffc2448b65ef | 4 | * @author MMY Application Team |
EnricoG | 0:ffc2448b65ef | 5 | * @version V1.0.0 |
EnricoG | 0:ffc2448b65ef | 6 | * @date 20-November-2013 |
EnricoG | 0:ffc2448b65ef | 7 | * @brief This file help to manage Data inside M24SR. |
EnricoG | 0:ffc2448b65ef | 8 | ****************************************************************************** |
EnricoG | 0:ffc2448b65ef | 9 | * @attention |
EnricoG | 0:ffc2448b65ef | 10 | * |
EnricoG | 0:ffc2448b65ef | 11 | * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> |
EnricoG | 0:ffc2448b65ef | 12 | * |
EnricoG | 0:ffc2448b65ef | 13 | * Licensed under MMY-ST Liberty SW License Agreement V2, (the "License"); |
EnricoG | 0:ffc2448b65ef | 14 | * You may not use this file except in compliance with the License. |
EnricoG | 0:ffc2448b65ef | 15 | * You may obtain a copy of the License at: |
EnricoG | 0:ffc2448b65ef | 16 | * |
EnricoG | 0:ffc2448b65ef | 17 | * http://www.st.com/software_license_agreement_liberty_v2 |
EnricoG | 0:ffc2448b65ef | 18 | * |
EnricoG | 0:ffc2448b65ef | 19 | * Unless required by applicable law or agreed to in writing, software |
EnricoG | 0:ffc2448b65ef | 20 | * distributed under the License is distributed on an "AS IS" BASIS, |
EnricoG | 0:ffc2448b65ef | 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
EnricoG | 0:ffc2448b65ef | 22 | * See the License for the specific language governing permissions and |
EnricoG | 0:ffc2448b65ef | 23 | * limitations under the License. |
EnricoG | 0:ffc2448b65ef | 24 | * |
EnricoG | 0:ffc2448b65ef | 25 | ****************************************************************************** |
EnricoG | 0:ffc2448b65ef | 26 | */ |
EnricoG | 0:ffc2448b65ef | 27 | |
EnricoG | 0:ffc2448b65ef | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EnricoG | 0:ffc2448b65ef | 29 | #ifndef __LIB_M24SR_H |
EnricoG | 0:ffc2448b65ef | 30 | #define __LIB_M24SR_H |
EnricoG | 0:ffc2448b65ef | 31 | |
EnricoG | 0:ffc2448b65ef | 32 | #ifdef __cplusplus |
EnricoG | 0:ffc2448b65ef | 33 | extern "C" { |
EnricoG | 0:ffc2448b65ef | 34 | #endif |
EnricoG | 0:ffc2448b65ef | 35 | |
EnricoG | 0:ffc2448b65ef | 36 | /* Includes ------------------------------------------------------------------*/ |
EnricoG | 0:ffc2448b65ef | 37 | #include "m24sr.h" |
EnricoG | 0:ffc2448b65ef | 38 | |
EnricoG | 0:ffc2448b65ef | 39 | /* ---------------------- M24SR properties -----------------------------------*/ |
EnricoG | 0:ffc2448b65ef | 40 | #define M24SR04_NDEF_MAX_SIZE 0x200 |
EnricoG | 0:ffc2448b65ef | 41 | #define M24SR16_NDEF_MAX_SIZE 0x800 |
EnricoG | 0:ffc2448b65ef | 42 | #define M24SR64_NDEF_MAX_SIZE 0x2000 |
EnricoG | 0:ffc2448b65ef | 43 | |
EnricoG | 0:ffc2448b65ef | 44 | |
EnricoG | 0:ffc2448b65ef | 45 | #define ASK_FOR_SESSION 0x0000 |
EnricoG | 0:ffc2448b65ef | 46 | #define TAKE_SESSION 0xFFFF |
EnricoG | 0:ffc2448b65ef | 47 | |
EnricoG | 0:ffc2448b65ef | 48 | /* M24SR buffer size is 0xF6 can be retrieve dynamicaly in CC file */ |
EnricoG | 0:ffc2448b65ef | 49 | #define M24SR_READ_MAX_NBBYTE 0xF6 |
EnricoG | 0:ffc2448b65ef | 50 | #define M24SR_WRITE_MAX_NBBYTE 0xF6 |
EnricoG | 0:ffc2448b65ef | 51 | |
EnricoG | 0:ffc2448b65ef | 52 | |
EnricoG | 0:ffc2448b65ef | 53 | #define NDEF_SESSION_CLOSED 0xDEADBEEF |
EnricoG | 0:ffc2448b65ef | 54 | |
EnricoG | 0:ffc2448b65ef | 55 | #ifndef errorchk |
EnricoG | 0:ffc2448b65ef | 56 | #define errorchk(fCall) if (status = (fCall), status != M24SR_ACTION_COMPLETED) \ |
EnricoG | 0:ffc2448b65ef | 57 | {goto Error;} else |
EnricoG | 0:ffc2448b65ef | 58 | #endif |
EnricoG | 0:ffc2448b65ef | 59 | |
EnricoG | 0:ffc2448b65ef | 60 | uint16_t M24SR_Initialization (uint8_t* pCCBuffer, uint8_t size ); |
EnricoG | 0:ffc2448b65ef | 61 | |
EnricoG | 0:ffc2448b65ef | 62 | uint16_t M24SR_GetNDEFFileId ( uint16_t *NDEF_fileID ); |
EnricoG | 0:ffc2448b65ef | 63 | uint16_t M24SR_OpenNDEFSession ( uint16_t NDEF_fileID, uint16_t Priority ); |
EnricoG | 0:ffc2448b65ef | 64 | uint16_t M24SR_ReadData ( uint16_t Offset , uint16_t DataSize , uint8_t* pData); |
EnricoG | 0:ffc2448b65ef | 65 | uint16_t M24SR_ForceReadData ( uint16_t Offset , uint16_t DataSize , uint8_t* pData); |
EnricoG | 0:ffc2448b65ef | 66 | uint16_t M24SR_WriteData ( uint16_t Offset , uint16_t DataSize , uint8_t* pData); |
EnricoG | 0:ffc2448b65ef | 67 | uint16_t M24SR_CloseNDEFSession ( uint16_t NDEF_fileID ); |
EnricoG | 0:ffc2448b65ef | 68 | |
EnricoG | 0:ffc2448b65ef | 69 | uint16_t M24SR_EnableReadPassword( uint8_t* pCurrentWritePassword, uint8_t* pNewPassword); |
EnricoG | 0:ffc2448b65ef | 70 | uint16_t M24SR_DisableReadPassword( uint8_t* pCurrentWritePassword ); |
EnricoG | 0:ffc2448b65ef | 71 | uint16_t M24SR_EnableWritePassword( uint8_t* pCurrentWritePassword, uint8_t* pNewPassword); |
EnricoG | 0:ffc2448b65ef | 72 | uint16_t M24SR_DisableWritePassword( uint8_t* pCurrentWritePassword ); |
EnricoG | 0:ffc2448b65ef | 73 | uint16_t M24SR_DisableAllPassword( uint8_t* pSuperUserPassword); |
EnricoG | 0:ffc2448b65ef | 74 | |
EnricoG | 0:ffc2448b65ef | 75 | uint16_t M24SR_EnableReadOnly( uint8_t* pCurrentWritePassword); |
EnricoG | 0:ffc2448b65ef | 76 | uint16_t M24SR_DisableReadOnly( uint8_t* pCurrentWritePassword); |
EnricoG | 0:ffc2448b65ef | 77 | uint16_t M24SR_EnableWriteOnly( uint8_t* pCurrentWritePassword); |
EnricoG | 0:ffc2448b65ef | 78 | uint16_t M24SR_DisableWriteOnly( uint8_t* pCurrentWritePassword); |
EnricoG | 0:ffc2448b65ef | 79 | |
EnricoG | 0:ffc2448b65ef | 80 | uint16_t M24SR_ManageGPO( uc8 GPO_config, uc8 mode); |
EnricoG | 0:ffc2448b65ef | 81 | |
EnricoG | 0:ffc2448b65ef | 82 | #ifdef __cplusplus |
EnricoG | 0:ffc2448b65ef | 83 | } |
EnricoG | 0:ffc2448b65ef | 84 | #endif |
EnricoG | 0:ffc2448b65ef | 85 | |
EnricoG | 0:ffc2448b65ef | 86 | |
EnricoG | 0:ffc2448b65ef | 87 | #endif /* __LIB_M24SR_H */ |
EnricoG | 0:ffc2448b65ef | 88 | |
EnricoG | 0:ffc2448b65ef | 89 | /******************* (C) COPYRIGHT 2013 STMicroelectronics *****END OF FILE****/ |