-
Notifications
You must be signed in to change notification settings - Fork 0
/
m24lr64.h
146 lines (119 loc) · 3.77 KB
/
m24lr64.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/**
******************************************************************************
* @file m24lr64.h
* @author MCD Application Team
* @brief This file is the header of m24lr64.c
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef M24LR64_H
#define M24LR64_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include <stddef.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup M24LR64
* @{
*/
/** @defgroup M24LR64_Exported_Types M24LR64 Exported Types
* @{
*/
typedef int32_t (*M24LR64_Init_Func) (void);
typedef int32_t (*M24LR64_DeInit_Func) (void);
typedef int32_t (*M24LR64_GetTick_Func) (void);
typedef int32_t (*M24LR64_Delay_Func) (uint32_t);
typedef int32_t (*M24LR64_WriteReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*M24LR64_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*M24LR64_IsDeviceReady_Func) (uint16_t, uint32_t);
typedef int32_t (*M24LR64_Write_Func)(void *, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*M24LR64_Read_Func) (void *, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*M24LR64_IsReady_Func) (void *, uint32_t);
typedef struct
{
M24LR64_Write_Func Write;
M24LR64_Read_Func Read;
M24LR64_IsReady_Func IsReady;
void *handle;
} M24LR64_Ctx_t;
typedef struct
{
M24LR64_Init_Func Init;
M24LR64_DeInit_Func DeInit;
uint16_t Address;
M24LR64_WriteReg_Func Write;
M24LR64_ReadReg_Func Read;
M24LR64_IsDeviceReady_Func IsReady;
M24LR64_GetTick_Func GetTick;
} M24LR64_IO_t;
typedef struct
{
M24LR64_IO_t IO;
M24LR64_Ctx_t Ctx;
uint8_t IsInitialized;
} M24LR64_Object_t;
typedef struct
{
int32_t (*Init )(M24LR64_Object_t*);
int32_t (*DeInit )(M24LR64_Object_t*);
int32_t (*Write )(M24LR64_Object_t*, uint16_t, uint8_t*, uint16_t);
int32_t (*Read )(M24LR64_Object_t*, uint16_t, uint8_t*, uint16_t);
int32_t (*IsReady )(M24LR64_Object_t*, uint32_t);
}M24LR64_EEPROM_Drv_t;
/**
* @}
*/
/** @defgroup M24LR64_Exported_Constants M24LR64 Exported Constants
* @{
*/
#define M24LR64_OK 0
#define M24LR64_ERROR -1
/**
* @}
*/
/** @defgroup M24LR64_Exported_FunctionsPrototypes M24LR64 Exported FunctionsPrototypes
* @{
*/
/* public function --------------------------------------------------------------------------*/
int32_t M24LR64_RegisterBusIO (M24LR64_Object_t *pObj, M24LR64_IO_t *pIO);
int32_t M24LR64_Init(M24LR64_Object_t *pObj);
int32_t M24LR64_DeInit(M24LR64_Object_t *pObj);
int32_t M24LR64_Write(M24LR64_Object_t *pObj, uint16_t Addr, uint8_t *Data, uint16_t Length);
int32_t M24LR64_Read(M24LR64_Object_t *pObj, uint16_t Addr, uint8_t *Data, uint16_t Length);
int32_t M24LR64_IsReady(M24LR64_Object_t *pObj, uint32_t Trials);
extern M24LR64_EEPROM_Drv_t M24LR64_EEPROM_Driver;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* M24LR64_H */
/******************* (C) COPYRIGHT STMicroelectronics *****END OF FILE****/