Appiko
SDK_EVAL_EEPROM.h
1 
27 /* Define to prevent recursive inclusion -------------------------------------*/
28 #ifndef SPIRIT_SDK_EEPROM_H_
29 #define SPIRIT_SDK_EEPROM_H_
30 
31 
32 /* Includes ------------------------------------------------------------------*/
33 #include "cube_hal.h"
34 
35 
36 #ifdef __cplusplus
37  "C" {
38 #endif
39 
40 
56 /* EEPROM SPI commands */
57 #define EEPROM_CMD_WREN 0x06 // Write Enable
58 #define EEPROM_CMD_WRDI 0x04 // Write Disable
59 #define EEPROM_CMD_RDSR 0x05 // Read Status Register
60 #define EEPROM_CMD_WRSR 0x01 // Write Status Register
61 #define EEPROM_CMD_READ 0x03 // Read from Memory Array
62 #define EEPROM_CMD_WRITE 0x02 // Write to Memory Array
63 
64 /* EEPROM SPI status */
65 #define EEPROM_STATUS_SRWD 0x80 // Status Register Write Disable
66 #define EEPROM_STATUS_BP 0x0C // Block Protect
67 #define EEPROM_STATUS_WEL 0x02 // Write Enable
68 #define EEPROM_STATUS_WIP 0x01 // Write in Progress
69 
70 
71 void EepromSpiInitialization(void);
72 void EepromCsPinInitialization(void);
73 void EepromCsXnucleoPinInitialization(void); //Added for Xnucleo Boards
74 
75 uint8_t EepromStatus(void);
76 void EepromRead(uint16_t nAddress, uint8_t cNbBytes, uint8_t* pcBuffer);
77 void EepromWrite(uint16_t nAddress, uint8_t cNbBytes, uint8_t* pcBuffer);
78 uint8_t EepromResetSrwd(void);
79 uint8_t EepromSetSrwd(void);
80 
81 void EepromWriteEnable(void);
82 uint8_t SdkEvalGetHasEeprom(void);
83 void SdkEvalSetHasEeprom(uint8_t eeprom);
84 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 
98 #endif
99 
100 
101  /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
102 
void EepromSpiInitialization(void)
Initializes the SPI for the EEPROM. SPI, MISO, MOSI and SCLK are the same used for the SPIRIT1....
void EepromCsPinInitialization(void)
Initialization of the CSn pin of the EEPROM. This function is called internally by EepromCsPinInitial...
uint8_t EepromResetSrwd(void)
Reset the ERSR status bit.
uint8_t SdkEvalGetHasEeprom(void)
This function is to query if EEPROM is present or not.
void SdkEvalSetHasEeprom(uint8_t eeprom)
This function is to set if EEPROM is present or not.
void EepromRead(uint16_t nAddress, uint8_t cNbBytes, uint8_t *pcBuffer)
Read a page of the EEPROM. A page size is 32 bytes. The pages are 256. Page 0 address: 0x0000 Page 1 ...
void EepromWrite(uint16_t nAddress, uint8_t cNbBytes, uint8_t *pcBuffer)
Write a page of the EEPROM. A page size is 32 bytes. The pages are 256. Page 0 address: 0x0000 Page 1...
uint8_t EepromStatus(void)
Read the status register.
void EepromCsXnucleoPinInitialization(void)
Initialization of the CSn pin of the EEPROM for XNUCLEO boards.
uint8_t EepromSetSrwd(void)
Set the ERSR status bit.
void EepromWriteEnable(void)
Set the internal WEL flag to allow write operation.