Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1073 - 1
/*****************************************************************************
2
 *   Copyright (C) 2010 seb@exse.net                                                                             *
3
 *   Copyright (C) 2011 Christian Brandtner brandtner@brandtner.net          *
4
 *                                                                           *
5
 *   This program is free software; you can redistribute it and/or modify    *
6
 *   it under the terms of the GNU General Public License as published by    *
7
 *   the Free Software Foundation; either version 2 of the License.          *
8
 *                                                                           *
9
 *   This program is distributed in the hope that it will be useful,         *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
12
 *   GNU General Public License for more details.                            *
13
 *                                                                           *
14
 *   You should have received a copy of the GNU General Public License       *
15
 *   along with this program; if not, write to the                           *
16
 *   Free Software Foundation, Inc.,                                         *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.               *
18
 *                                                                           *
19
 *****************************************************************************/
20
/*14.6.2011 Parameter erweitert Wi232 Cebra */
21
 
22
#include <avr/io.h>
23
#include <avr/pgmspace.h>
24
#include <util/delay.h>
25
#include <stdlib.h>
26
#include <string.h>
27
#include <avr/eeprom.h>
28
#include "lcd.h"
29
#include "main.h"
30
#include "timer.h"
31
#include "eeprom.h"
32
 
33
 
34
//*****************************************************************************
35
// 
36
 
37
uint8_t EE_LowBat               EEMEM= 137;
38
uint8_t EE_DisplayTimeout       EEMEM= 0;
39
uint8_t EE_DisplayLanguage      EEMEM= 0;
40
uint8_t EE_WiTXRXChannel        EEMEM= 1;
41
uint8_t EE_WiNetworkGroup       EEMEM=66;
42
uint8_t EE_PKTVersion           EEMEM=1;
43
 
44
volatile uint8_t DisplayTimeout;
45
volatile uint8_t DisplayLanguage;
46
volatile uint8_t WiTXRXChannel;
47
volatile uint8_t WiNetworkGroup;
48
uint8_t Eepromversion;
49
//*****************************************************************************
50
// 
51
void ReadParameter (void)
52
{
53
        MK_LowBat = eeprom_read_byte(&EE_LowBat);
54
        DisplayTimeout = eeprom_read_byte(&EE_DisplayTimeout);
55
        DisplayLanguage = eeprom_read_byte(&EE_DisplayLanguage);
56
        WiTXRXChannel =eeprom_read_byte(&EE_WiTXRXChannel);
57
        WiNetworkGroup =eeprom_read_byte(&EE_WiNetworkGroup);
58
 
59
        if (eeprom_read_byte(&EE_PKTVersion)!= 0x01)
60
 
61
        { /* EEPROM auf Default setzen*/
62
                Eepromversion = 1;
63
                MK_LowBat = 137;
64
                DisplayTimeout = 0;
65
                DisplayLanguage = 0;
66
                WiTXRXChannel = 1;
67
                WiNetworkGroup = 66;
68
            eeprom_write_byte(&EE_LowBat, MK_LowBat);
69
                eeprom_write_byte(&EE_DisplayTimeout, DisplayTimeout);
70
                eeprom_write_byte(&EE_DisplayLanguage, DisplayLanguage);
71
                eeprom_write_byte(&EE_WiTXRXChannel, WiTXRXChannel);
72
                eeprom_write_byte(&EE_WiNetworkGroup, WiNetworkGroup);
73
                eeprom_write_byte(&EE_PKTVersion,Eepromversion);
74
 
75
 
76
                lcd_cls ();
77
                lcd_printp (PSTR("EEPROM Parameter\r\n"), 0);
78
                lcd_printp (PSTR("auf Default gesetzt\r\n"), 0);
79
                lcd_printp (PSTR("weiter mit ENTER\r\n"), 0);
80
                while (!(get_key_press (1 << KEY_ENTER)));
81
                return;
82
         }
83
 
84
 
85
}
86
 
87
//*****************************************************************************
88
// 
89
void WriteParameter (void)
90
{
91
         eeprom_write_byte(&EE_LowBat, MK_LowBat);
92
         eeprom_write_byte(&EE_DisplayTimeout, DisplayTimeout);
93
         eeprom_write_byte(&EE_DisplayLanguage, DisplayLanguage);
94
         eeprom_write_byte(&EE_WiTXRXChannel, WiTXRXChannel);
95
         eeprom_write_byte(&EE_WiNetworkGroup, WiNetworkGroup);
96
}