Sensorian
1.0
C API Reference Guide Library
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
EEPROM.h
Go to the documentation of this file.
1
/****************************************************************************
2
* Copyright (C) 2015 Sensorian
3
* *
4
* This file is part of Sensorian. *
5
* *
6
* Sensorian is free software: you can redistribute it and/or modify it *
7
* under the terms of the GNU Lesser General Public License as published *
8
* by the Free Software Foundation, either version 3 of the License, or *
9
* (at your option) any later version. *
10
* *
11
* Sensorian is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Lesser General Public License for more details. *
15
* *
16
* You should have received a copy of the GNU Lesser General Public *
17
* License along with Sensorian. *
18
* If not, see <http://www.gnu.org/licenses/>. *
19
****************************************************************************/
20
29
#ifndef __EEPROM_H__
30
#define __EEPROM_H__
31
32
#include "bcm2835.h"
33
38
#define EEPROM_ADDRESS 0x57
39
40
#define EEPROM_WRITE 0xae // DEVICE ADDR for EEPROM (writes)
41
#define EEPROM_READ 0xaf // DEVICE ADDR for EEPROM (reads)
42
#define EEUNLOCK 0x09
43
44
#define EEPROM_START 0x00
45
#define EEPROM_END 0x7F
46
47
#define EEPROM_PROTECTED_START 0xF0
48
#define EEPROM_PROTECTED_END 0xF7
49
50
#define BP0 0x04
51
#define BP1 0x08
52
53
/************************* RTCC Memory map ****************************/
54
55
#define EEPROM_WRITE 0xae // DEVICE ADDR for EEPROM (writes)
56
#define EEPROM_READ 0xaf // DEVICE ADDR for EEPROM (reads)
57
58
#define SRAM_PTR 0x20 // pointer of the SRAM area (RTCC)
59
#define EEPROM_SREG 0xff // STATUS REGISTER in the EEPROM
60
61
/*********************************************************************/
62
64
typedef
enum
PROTECTION
{
QUARTER
= 0x01,
65
HALF
= 0x02,
66
ALL
= 0x03
67
}
ProtectionSettings_t
;
68
69
#define TRUE 1
70
#define FALSE 0
71
72
/***************************Function definitions********************************************/
73
74
void
EEPROM_Write
(
unsigned
char
mem_address,
unsigned
char
ee_data);
75
void
EEPROM_WriteProtected
(
unsigned
char
mem_address,
unsigned
char
ee_data);
76
unsigned
char
EEPROM_Read
(
unsigned
char
mem_address);
77
void
EEPROM_SetBlockProtection
(
ProtectionSettings_t
protSetting);
78
void
EEPROM_ReadPage
(
char
mem_address,
char
*
buffer
);
79
void
EEPROM_WritePage
(
char
mem_address,
char
*
buffer
);
80
81
82
#endif
83
QUARTER
Definition:
EEPROM.h:64
buffer
unsigned char buffer[256]
Definition:
main.c:74
EEPROM_SetBlockProtection
void EEPROM_SetBlockProtection(ProtectionSettings_t protSetting)
This function sets the Block protection settings.
Definition:
EEPROM.c:81
PROTECTION
PROTECTION
Definition:
EEPROM.h:64
EEPROM_Read
unsigned char EEPROM_Read(unsigned char mem_address)
The function reads a data byte from the EEPROM.
Definition:
EEPROM.c:70
EEPROM_WriteProtected
void EEPROM_WriteProtected(unsigned char mem_address, unsigned char ee_data)
The function writes to the protected EEPROM space.
Definition:
EEPROM.c:57
EEPROM_Write
void EEPROM_Write(unsigned char mem_address, unsigned char ee_data)
This function writes a single byte in the I2C EEPROM.
Definition:
EEPROM.c:45
HALF
Definition:
EEPROM.h:65
EEPROM_WritePage
void EEPROM_WritePage(char mem_address, char *buffer)
This function writes a single page to the RTCC EEPROM.
Definition:
EEPROM.c:92
ALL
Definition:
EEPROM.h:66
EEPROM_ReadPage
void EEPROM_ReadPage(char mem_address, char *buffer)
This function reads a single page from the RTCC EEPROM.
Definition:
EEPROM.c:102
ProtectionSettings_t
enum PROTECTION ProtectionSettings_t
MCP79410_EEPROM
Example1
EEPROM.h
Generated on Sun Jul 12 2015 20:25:29 for Sensorian by
1.8.9.1