-
Notifications
You must be signed in to change notification settings - Fork 0
/
m24m02.h
130 lines (115 loc) · 3.04 KB
/
m24m02.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
/*
*Lib defining the MAX 44009 for the Exeger Light band project .
*20/05/2014
*Copyright Exeger Systems AB 2014
*
*Author:Kartik karuna (Kartik.karuna@exeger.com)
*
*/
#ifndef M24m02_H__
#define M24m02_H__
#include <stdbool.h>
#include <stdint.h>
void i2c_eeprom_init();
/**
* Function: i2c_eeprom_erase
*
* Arguments: n/a
*
* Returns: true/false
*
* Description: Erases the EEPROM.
**/
bool i2c_eeprom_erase();
/**
* Function: i2c_eeprom_write_page
*
* Arguments: 18 bit address
* pointer to the data.
* length of data
*
* Returns: true/false
*
* Description: Reads both the light registers on the device and returns the
* computed light level
**/
bool i2c_eeprom_write(uint32_t address, uint8_t* data, uint32_t length);
bool i2c_eeprom_write_buffer(uint8_t dev_id, uint16_t address, uint8_t* data, uint16_t length);
/**
* Function: i2c_eeprom_write_page
*
* Arguments: Device Address
* 16 bit eeprom address
* pointer to the data.
* length of data
*
* Returns: true/false
*
* Description: Reads both the light registers on the device and returns the
* computed light level
**/
bool i2c_eeprom_write_page(uint8_t dev_id, uint16_t eeaddress, uint8_t* data, uint8_t length );
/**
* Function: i2c_eeprom_current_address
*
* Arguments: n/a
*
* Returns: 32 bit current address
*
* Description: Function to fint the current address of the EEPROM
*
**/
//uint32_t i2c_eeprom_current_address();
/**
* Function: i2c_eeprom_address_read
*
* Arguments: Device Address
*
* Returns: 16 bit current address of each eeprom device.
*
* Description: Function to fint the current address of the EEPROM
*
**/
//uint16_t i2c_eeprom_address_read(uint8_t dev_id);
/**
* Function: i2c_eeprom_read_byte
*
* Arguments: Device Address
* 16 bit eeprom address
*
* Returns: true/false
*
* Description: Reads both the light registers on the device and returns the
* computed light level
**/
uint8_t i2c_eeprom_read_byte(uint8_t dev_id, uint16_t eeaddress);
/**
* Function: i2c_eeprom_read_buffer
*
* Arguments: 18 bit eeprom address
* pointer to the data.
* length of data
*
* Returns: true/false
*
* Description: Reads both the light registers on the device and returns the
* computed light level
**/
bool i2c_eeprom_read(uint32_t address, uint8_t* data, uint32_t length);
/**
* Function: i2c_eeprom_read_buffer
*
* Arguments: Device Address
* 16 bit eeprom address
* pointer to the data.
* length of data
*
* Returns: true/false
*
* Description: Reads both the light registers on the device and returns the
* computed light level
**/
bool i2c_eeprom_read_buffer(uint8_t dev_id, uint16_t address, uint8_t *buffer, uint16_t length);
uint32_t eeprom_find_add_pointer(void);
bool eeprom_updateadd_pointer(uint32_t address);
#endif // M24m02_H__