-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path24C02.h
48 lines (37 loc) · 1.89 KB
/
24C02.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
/*********************************************************************************************************
*
* File : 24c02.h
* Hardware Environment:
* Build Environment : RealView MDK-ARM Version: 4.20
* Version : V1.0
* By :
*
* (c) Copyright 2005-2011, WaveShare
* http://www.waveshare.net
* All Rights Reserved
*
*********************************************************************************************************/
#ifndef __24C02_H
#define __24C02_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
/* Private define ------------------------------------------------------------*/
#define AT24C01A
//#define AT24C01
#define ADDR_24LC02 0xA0 //1010 0000
#define I2C_PAGESIZE 4
/* Maximum Timeout values for flags and events waiting loops. These timeouts are
not based on accurate values, they just guarantee that the application will
not remain stuck if the I2C communication is corrupted.
You may modify these timeout values depending on CPU frequency and application
conditions (interrupts routines ...). */
#define I2C_Open_FLAG_TIMEOUT ((uint32_t)0x1000)
#define I2C_Open_LONG_TIMEOUT ((uint32_t)(10 * I2C_Open_FLAG_TIMEOUT))
/* Private function prototypes -----------------------------------------------*/
void I2C_Configuration(void);
uint8_t I2C_Read(I2C_TypeDef *I2Cx,uint8_t I2C_Addr,uint8_t addr,uint8_t *buf,uint16_t num);
uint8_t I2C_Write(I2C_TypeDef *I2Cx,uint8_t I2C_Addr,uint8_t addr,uint8_t *buf,uint16_t num);
#endif
/*********************************************************************************************************
END FILE
*********************************************************************************************************/