-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
ee24.h
81 lines (62 loc) · 2.8 KB
/
ee24.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
#ifndef _EE24_H_
#define _EE24_H_
/***********************************************************************************************************
Author: Nima Askari
Github: https://www.github.com/NimaLTD
LinkedIn: https://www.linkedin.com/in/nimaltd
Youtube: https://www.youtube.com/@nimaltd
Instagram: https://instagram.com/github.NimaLTD
Version: 3.2.0
History:
3.2.0
- Added ThreadX Configuration
3.1.0
- Added WP pin control
- Fix 1Kb and 2Kb memory writing
3.0.1
- Fixed Address
3.0.0
- Rewrite again
- Support STM32CubeMx Packet installer
***********************************************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/************************************************************************************************************
************** Include Headers
************************************************************************************************************/
#include <stdbool.h>
#include "i2c.h"
#include "NimaLTD.I-CUBE-EE24_conf.h"
/************************************************************************************************************
************** Public Definitions
************************************************************************************************************/
#define EE24_ADDRESS_DEFAULT 0xA0
/************************************************************************************************************
************** Public struct/enum
************************************************************************************************************/
typedef struct
{
I2C_HandleTypeDef *HI2c;
uint8_t Address;
uint8_t Lock;
#if EE24_USE_WP_PIN == true
GPIO_TypeDef *WpGpio;
uint16_t WpPin;
#endif
} EE24_HandleTypeDef;
/************************************************************************************************************
************** Public Functions
************************************************************************************************************/
#if EE24_USE_WP_PIN == false
bool EE24_Init(EE24_HandleTypeDef *Handle, I2C_HandleTypeDef *HI2c, uint8_t I2CAddress);
#else
bool EE24_Init(EE24_HandleTypeDef *Handle, I2C_HandleTypeDef *HI2c, uint8_t I2CAddress, GPIO_TypeDef *WpGpio, uint16_t WpPin);
#endif
bool EE24_Read(EE24_HandleTypeDef *Handle, uint32_t Address, uint8_t *Data, size_t Len, uint32_t Timeout);
bool EE24_Write(EE24_HandleTypeDef *Handle, uint32_t Address, uint8_t *Data, size_t Len, uint32_t Timeout);
#ifdef __cplusplus
}
#endif
#endif