-
Notifications
You must be signed in to change notification settings - Fork 4
/
E24C1024.h
62 lines (47 loc) · 1.87 KB
/
E24C1024.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
#ifndef E24C1024_h
#define E24C1024_h
/*
E24C1024.h
AT24C1024 Library for Arduino
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US
This library is based on several projects:
The Arduino EEPROM library found here:
http://arduino.cc/en/Reference/EEPROM
The 24C256 library found here:
http://www.arduino.cc/playground/Code/I2CEEPROM
The 24C512 library found here:
http://www.arduino.cc/playground/Code/I2CEEPROM24LC512
Our project page is here:
http://www.arduino.cc/playground/Code/I2CEEPROM24C1024
From the datasheet:
The AT24C1024B provides 1,048,576 bits of serial electrically
erasable and programmable read only memory (EEPROM) organized
as 131,072 words of 8 bits each. The device’s cascadable
feature allows up to four devices to share a common two-wire
bus.
http://www.atmel.com/dyn/resources/prod_documents/doc5194.pdf
*/
#include "Arduino.h"
#include <Wire.h>
#define FULL_MASK 0x7FFFF
#define DEVICE_MASK 0x7F0000
#define WORD_MASK 0xFFFF
class E24C1024
{
public:
E24C1024();
static void write(unsigned long, uint8_t);
static uint8_t read(unsigned long);
};
extern E24C1024 EEPROM1024;
#endif