ARMEBS4  revision-26.06.2015
eeprom.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////
2 /// \file heivs/eeprom.h
3 /// \brief ARMEBS4 eeprom access functions
4 /// \author Pascal Sartoretti (sap at hevs dot ch)
5 //////////////////////////////////////////////////////////////////////////////////
6 /**
7  * \addtogroup libheivs_stm32_eeprom External EEPROM
8  * \brief Stores board SN, MAC address and Touchscreen calibration
9  * \ingroup onboard
10  * @{
11  ***************************************************************************/
12 #ifndef HEIVS_EEPROM_H
13 #define HEIVS_EEPROM_H
14 
15 #include <stdint.h>
16 #include "heivs/error.h"
17 
18 #ifdef __cplusplus
19  extern "C" {
20 #endif
21 
22 //////////////////////////////////////////////////////////////////////////////////
23 /// \brief Returns the unique number from the EEPROM
24 /// \param number pointer to unique number for ARMEBS4 (1-255)
25 /// \return error type possible are :
26 /// \li #NO_ERROR - all is OK
27 /// \li #ERROR_EEPROM_BAD_MAGIC - eeeprom is not ok (call EEPROM_FirstInit())
28 /// \li any other I2C possible error from I2C
29 //////////////////////////////////////////////////////////////////////////////////
30 status_e EEPROM_ReadUniqueNumber(uint8_t *number);
31 
32 //////////////////////////////////////////////////////////////////////////////////
33 /// \brief Write the touch calbration to EEPROM
34 /// \param calib pointer to calib structure, null for reseting the calibration
35 /// \return error type possible are :
36 /// \li #NO_ERROR - all is OK
37 /// \li #ERROR_EEPROM_BAD_MAGIC - eeeprom is not ok (call EEPROM_FirstInit())
38 /// \li any other I2C possible error from I2C
39 //////////////////////////////////////////////////////////////////////////////////
40 status_e EEPROM_Calib_Write(const uint8_t calib[24]);
41 
42 //////////////////////////////////////////////////////////////////////////////////
43 /// \brief Returns the touch calbration from EEPROM
44 /// \param calib pointer to calib structure
45 /// \return error type possible are :
46 /// \li #NO_ERROR - all is OK
47 /// \li #ERROR_EEPROM_BAD_MAGIC - eeeprom is not ok (call EEPROM_FirstInit())
48 /// \li #ERROR_EEPROM_BAD_CALIB - calibration is not valid
49 /// \li any other I2C possible error from I2C
50 //////////////////////////////////////////////////////////////////////////////////
51 status_e EEPROM_Calib_Read(uint8_t calib[24]);
52 
53 //////////////////////////////////////////////////////////////////////////////////
54 /// \brief Returns the mac address
55 /// \param mac pointer to the mac address (6*uint8_t)
56 /// \return error type possible are :
57 /// \li #NO_ERROR - all is OK
58 /// \li #ERROR_EEPROM_BAD_MAGIC - eeeprom is not ok (call EEPROM_FirstInit())
59 /// \li any other I2C possible error from I2C
60 //////////////////////////////////////////////////////////////////////////////////
61 status_e EEPROM_ReadMacAddress(uint8_t *mac);
62 
63 
64 
65 //////////////////////////////////////////////////////////////////////////////////
66 /// \brief First initialisation of EEPROM
67 /// \param number value to set to this ARMEBS4 board
68 /// \param macAddr pointer to structure of MAC address (6 bytes pointer)
69 /// \return error type possible are :
70 /// \li #NO_ERROR - all is OK
71 /// \li #ERROR_BAD_PARAM - a parameter is missing
72 /// \li any other I2C possible error from I2C
73 /// Touchscreen calibration is erased
74 //////////////////////////////////////////////////////////////////////////////////
75 status_e EEPROM_FirstInit(uint8_t number, uint8_t *macAddr);
76 
77 #ifdef __cplusplus
78  }
79 #endif
80 
81 /**
82  * @}
83  */
84 #endif /* HEIVS_EEPROM_H */
status_e EEPROM_FirstInit(uint8_t number, uint8_t *macAddr)
First initialisation of EEPROM.
Definition: eeprom.c:216
Errors definitions.
status_e EEPROM_Calib_Write(const uint8_t calib[24])
Write the touch calbration to EEPROM.
Definition: eeprom.c:186
status_e EEPROM_Calib_Read(uint8_t calib[24])
Returns the touch calbration from EEPROM.
Definition: eeprom.c:142
status_e EEPROM_ReadMacAddress(uint8_t *mac)
Returns the mac address.
Definition: eeprom.c:165
status_e
Known errors.
Definition: error.h:21
status_e EEPROM_ReadUniqueNumber(uint8_t *number)
Returns the unique number from the EEPROM.
Definition: eeprom.c:123