forked from nimaltd/ee24
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathee24.h
68 lines (52 loc) · 2.23 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
#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.0.1
History:
3.0.1
- Fix Address
3.0.0
- Rewrite again
- Support STM32CubeMx Packet installer
***********************************************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdbool.h>
#include "NimaLTD.I-CUBE-EE24_conf.h"
#include "i2c.h"
#if EE24_CMSIS_RTOS == EE24_CMSIS_RTOS_DISABLE
#define EE24_Delay(x) HAL_Delay(x)
#elif EE24_CMSIS_RTOS == EE24_CMSIS_RTOS_V1
#include "cmsis_os.h"
#define EE24_Delay(x) osDelay(x)
#else
#include "cmsis_os2.h"
#define EE24_Delay(x) osDelay(x)
#endif
#define EE24_ADDRESS_DEFAULT 0xA0
/***********************************************************************************************************/
/***********************************************************************************************************/
/***********************************************************************************************************/
typedef struct
{
I2C_HandleTypeDef *HI2c;
uint8_t Address;
uint8_t Lock;
} EE24_HandleTypeDef;
/***********************************************************************************************************/
/***********************************************************************************************************/
/***********************************************************************************************************/
bool EE24_Init(EE24_HandleTypeDef *Handle, I2C_HandleTypeDef *HI2c, uint8_t I2CAddress);
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