0,0 → 1,96 |
/***************************************************************************** |
* Copyright (C) 2010 seb@exse.net * |
* Copyright (C) 2011 Christian Brandtner brandtner@brandtner.net * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
/*14.6.2011 Parameter erweitert Wi232 Cebra */ |
|
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <stdlib.h> |
#include <string.h> |
#include <avr/eeprom.h> |
#include "lcd.h" |
#include "main.h" |
#include "timer.h" |
#include "eeprom.h" |
|
|
//***************************************************************************** |
// |
|
uint8_t EE_LowBat EEMEM= 137; |
uint8_t EE_DisplayTimeout EEMEM= 0; |
uint8_t EE_DisplayLanguage EEMEM= 0; |
uint8_t EE_WiTXRXChannel EEMEM= 1; |
uint8_t EE_WiNetworkGroup EEMEM=66; |
uint8_t EE_PKTVersion EEMEM=1; |
|
volatile uint8_t DisplayTimeout; |
volatile uint8_t DisplayLanguage; |
volatile uint8_t WiTXRXChannel; |
volatile uint8_t WiNetworkGroup; |
uint8_t Eepromversion; |
//***************************************************************************** |
// |
void ReadParameter (void) |
{ |
MK_LowBat = eeprom_read_byte(&EE_LowBat); |
DisplayTimeout = eeprom_read_byte(&EE_DisplayTimeout); |
DisplayLanguage = eeprom_read_byte(&EE_DisplayLanguage); |
WiTXRXChannel =eeprom_read_byte(&EE_WiTXRXChannel); |
WiNetworkGroup =eeprom_read_byte(&EE_WiNetworkGroup); |
|
if (eeprom_read_byte(&EE_PKTVersion)!= 0x01) |
|
{ /* EEPROM auf Default setzen*/ |
Eepromversion = 1; |
MK_LowBat = 137; |
DisplayTimeout = 0; |
DisplayLanguage = 0; |
WiTXRXChannel = 1; |
WiNetworkGroup = 66; |
eeprom_write_byte(&EE_LowBat, MK_LowBat); |
eeprom_write_byte(&EE_DisplayTimeout, DisplayTimeout); |
eeprom_write_byte(&EE_DisplayLanguage, DisplayLanguage); |
eeprom_write_byte(&EE_WiTXRXChannel, WiTXRXChannel); |
eeprom_write_byte(&EE_WiNetworkGroup, WiNetworkGroup); |
eeprom_write_byte(&EE_PKTVersion,Eepromversion); |
|
|
lcd_cls (); |
lcd_printp (PSTR("EEPROM Parameter\r\n"), 0); |
lcd_printp (PSTR("auf Default gesetzt\r\n"), 0); |
lcd_printp (PSTR("weiter mit ENTER\r\n"), 0); |
while (!(get_key_press (1 << KEY_ENTER))); |
return; |
} |
|
|
} |
|
//***************************************************************************** |
// |
void WriteParameter (void) |
{ |
eeprom_write_byte(&EE_LowBat, MK_LowBat); |
eeprom_write_byte(&EE_DisplayTimeout, DisplayTimeout); |
eeprom_write_byte(&EE_DisplayLanguage, DisplayLanguage); |
eeprom_write_byte(&EE_WiTXRXChannel, WiTXRXChannel); |
eeprom_write_byte(&EE_WiNetworkGroup, WiNetworkGroup); |
} |