1 /*!
2  * \file      eeprom-board.h
3  *
4  * \brief     Target board EEPROM driver implementation
5  *
6  * \copyright Revised BSD License, see section \ref LICENSE.
7  *
8  * \code
9  *                ______                              _
10  *               / _____)             _              | |
11  *              ( (____  _____ ____ _| |_ _____  ____| |__
12  *               \____ \| ___ |    (_   _) ___ |/ ___)  _ \
13  *               _____) ) ____| | | || |_| ____( (___| | | |
14  *              (______/|_____)_|_|_| \__)_____)\____)_| |_|
15  *              (C)2013-2017 Semtech
16  *
17  * \endcode
18  *
19  * \author    Miguel Luis ( Semtech )
20  *
21  * \author    Gregory Cristian ( Semtech )
22  */
23 #ifndef __EEPROM_BOARD_H__
24 #define __EEPROM_BOARD_H__
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
31 #include <stdint.h>
32 #include "utilities.h"
33 
34 /*!
35  * Writes the given buffer to the EEPROM at the specified address.
36  *
37  * \param[IN] addr EEPROM address to write to
38  * \param[IN] buffer Pointer to the buffer to be written.
39  * \param[IN] size Size of the buffer to be written.
40  * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
41  */
42 LmnStatus_t EepromMcuWriteBuffer( uint16_t addr, uint8_t *buffer, uint16_t size );
43 
44 /*!
45  * Reads the EEPROM at the specified address to the given buffer.
46  *
47  * \param[IN] addr EEPROM address to read from
48  * \param[OUT] buffer Pointer to the buffer to be written with read data.
49  * \param[IN] size Size of the buffer to be read.
50  * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
51  */
52 LmnStatus_t EepromMcuReadBuffer( uint16_t addr, uint8_t *buffer, uint16_t size );
53 
54 /*!
55  * Sets the device address.
56  *
57  * \remark Useful for I2C external EEPROMS
58  *
59  * \param[IN] addr External EEPROM address
60  */
61 void EepromMcuSetDeviceAddr( uint8_t addr );
62 
63 /*!
64  * Gets the current device address.
65  *
66  * \remark Useful for I2C external EEPROMS
67  *
68  * \retval addr External EEPROM address
69  */
70 LmnStatus_t EepromMcuGetDeviceAddr( void );
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif // __EEPROM_BOARD_H__
77