Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
730 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
#ifndef USE_MMT
27
#include "lipo.h"
28
#endif
29
#include "timer.h"
30
 
31
//*****************************************************************************
32
// 
33
unsigned char EEPromArray[E2END+1] EEMEM;
34
 
35
//*****************************************************************************
36
// 
37
void WriteParameterDefaults (void)
38
{
39
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_VALID], EEPROM_REV);
40
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_ORIENTATION], 0);
41
#ifndef USE_MMT
42
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_LIPO], 33);
43
#endif
44
}
45
 
46
//*****************************************************************************
47
// 
48
void ReadParameter (void)
49
{
50
        if ((eeprom_read_byte(&EEPromArray[EEPROM_ADDR_VALID])) != EEPROM_REV)
51
        {
52
                WriteParameterDefaults();
53
        }
54
        LCD_ORIENTATION = eeprom_read_byte (&EEPromArray[EEPROM_ADDR_ORIENTATION]);
55
#ifndef USE_MMT
56
        AD_WarnLevel = eeprom_read_byte (&EEPromArray[EEPROM_ADDR_LIPO]);
57
#endif
58
}
59
 
60
//*****************************************************************************
61
// 
62
void WriteParameter (void)
63
{
64
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_ORIENTATION], LCD_ORIENTATION);
65
#ifndef USE_MMT
66
        eeprom_write_byte(&EEPromArray[EEPROM_ADDR_LIPO], AD_WarnLevel);
67
#endif
68
}