Sensorian  1.0
C API Reference Guide Library
EEPROM.c
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 #include "EEPROM.h"
30 #include "i2c.h"
31 #include <time.h>
32 #include <stdlib.h>
33 
37 
38 
45 void EEPROM_Write(unsigned char mem_address, unsigned char ee_data)
46 {
47  I2C_WriteByteRegister(mem_address,ee_data);
48 }
49 
50 
57 void EEPROM_WriteProtected(unsigned char mem_address, unsigned char ee_data)
58 {
61  I2C_WriteByteRegister(mem_address,ee_data);
62 }
63 
64 
70 unsigned char EEPROM_Read(unsigned char mem_address)
71 {
72  return I2C_ReadByteRegister(mem_address);
73 }
74 
75 
82 {
84 }
85 
86 
92 void EEPROM_WritePage(char mem_address,char *buffer)
93 {
94  I2C_WriteByteArray(mem_address,buffer,8);
95 }
96 
102 void EEPROM_ReadPage(char mem_address,char *buffer)
103 {
104  I2C_ReadByteArray(mem_address,buffer,8);
105 }
106 
107 /// @}
unsigned char buffer[256]
Definition: main.c:74
void EEPROM_SetBlockProtection(ProtectionSettings_t protSetting)
This function sets the Block protection settings.
Definition: EEPROM.c:81
unsigned char EEPROM_Read(unsigned char mem_address)
The function reads a data byte from the EEPROM.
Definition: EEPROM.c:70
#define EEUNLOCK
Definition: EEPROM.h:42
void EEPROM_WriteProtected(unsigned char mem_address, unsigned char ee_data)
The function writes to the protected EEPROM space.
Definition: EEPROM.c:57
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
void I2C_WriteByteArray(char reg, char *data, unsigned int length)
Writes a buffer array to the registers.
Definition: i2c.c:100
void EEPROM_WritePage(char mem_address, char *buffer)
This function writes a single page to the RTCC EEPROM.
Definition: EEPROM.c:92
void I2C_WriteByteRegister(unsigned char reg, unsigned char data)
Writes a byte value to a register address.
Definition: i2c.c:66
void EEPROM_ReadPage(char mem_address, char *buffer)
This function reads a single page from the RTCC EEPROM.
Definition: EEPROM.c:102
#define EEPROM_SREG
Definition: EEPROM.h:59
EEPROM driver header.
enum PROTECTION ProtectionSettings_t
unsigned char I2C_ReadByteRegister(char reg)
Reads a byte from a register.
Definition: i2c.c:122
I2C driver header.
void I2C_ReadByteArray(char reg, char *buffer, unsigned int length)
Initializes the I2C peripheral.
Definition: i2c.c:138