Subversion Repositories Projects

Rev

Rev 724 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
724 woggle 1
/*****************************************************************************
2
 *   Copyright (C) 2010 Peter "woggle" Mack, mac@denich.net                  *
3
 *                                                                           *
4
 *   This program is free software; you can redistribute it and/or modify    *
5
 *   it under the terms of the GNU General Public License as published by    *
6
 *   the Free Software Foundation; either version 2 of the License.          *
7
 *                                                                           *
8
 *   This program is distributed in the hope that it will be useful,         *
9
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
10
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
11
 *   GNU General Public License for more details.                            *
12
 *                                                                           *
13
 *   You should have received a copy of the GNU General Public License       *
14
 *   along with this program; if not, write to the                           *
15
 *   Free Software Foundation, Inc.,                                         *
16
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.               *
17
 *                                                                           *
18
 *****************************************************************************/
19
 
20
#include <avr/io.h>
21
#include <avr/eeprom.h>
22
#include <avr/pgmspace.h>
23
 
24
#include "eeprom.h"
25
#include "lcd.h"
26
#include "lipo.h"
27
#include "timer.h"
28
 
29
//*****************************************************************************
30
// 
31
unsigned char EEPromArray[E2END+1] EEMEM;
32
 
33
//*****************************************************************************
34
// 
35
void WriteParameterDefaults (void)
36
{
37
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_VALID], EEPROM_REV);
38
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_ORIENTATION], 0);
39
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_LIPO], 33);
40
}
41
 
42
//*****************************************************************************
43
// 
44
void ReadParameter (void)
45
{
46
        if ((eeprom_read_byte(&EEPromArray[EEPROM_ADDR_VALID])) != EEPROM_REV)
47
        {
48
                WriteParameterDefaults();
49
        }
50
        LCD_ORIENTATION = eeprom_read_byte (&EEPromArray[EEPROM_ADDR_ORIENTATION]);
51
        AD_WarnLevel = eeprom_read_byte (&EEPromArray[EEPROM_ADDR_LIPO]);
52
}
53
 
54
//*****************************************************************************
55
// 
56
void WriteParameter (void)
57
{
58
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_ORIENTATION], LCD_ORIENTATION);
59
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_LIPO], AD_WarnLevel);
60
}