* Channel is saved in EEPROM

* Allow serial port to work with more term emulators
This commit is contained in:
c_oflynn 2008-10-27 18:03:25 +00:00
parent 545eaedee4
commit 46853d9395
3 changed files with 17 additions and 5 deletions

View file

@ -59,6 +59,7 @@
#include <stdio.h> #include <stdio.h>
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <util/delay.h> #include <util/delay.h>
#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) #define BUF ((struct uip_eth_hdr *)&uip_buf[0])
@ -221,6 +222,8 @@ void menu_process(char c)
//If valid input, change it //If valid input, change it
if (tempchannel) { if (tempchannel) {
radio_set_operating_channel(tempchannel); radio_set_operating_channel(tempchannel);
eeprom_write_byte(9, tempchannel); //Write channel
eeprom_write_byte(10, ~tempchannel); //Bit inverse as check
} }
menustate = normal; menustate = normal;

View file

@ -128,7 +128,7 @@ Bool usb_user_read_request(U8 type, U8 request)
/* We don't have a real serial port - so these aren't applicable. We /* We don't have a real serial port - so these aren't applicable. We
advertise that we support nothing, so shouldn't get them anyway */ advertise that we support nothing, so shouldn't get them anyway */
/* case GET_LINE_CODING: case GET_LINE_CODING:
cdc_get_line_coding(); cdc_get_line_coding();
return TRUE; return TRUE;
break; break;
@ -142,8 +142,7 @@ Bool usb_user_read_request(U8 type, U8 request)
cdc_set_control_line_state(); cdc_set_control_line_state();
return TRUE; return TRUE;
break; break;
*/ default:
default:
break; break;
} }

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: sicslowmac.c,v 1.3 2008/10/14 18:36:07 c_oflynn Exp $ * $Id: sicslowmac.c,v 1.4 2008/10/27 18:03:26 c_oflynn Exp $
*/ */
@ -483,7 +483,17 @@ PROCESS_THREAD(mac_process, ev, data)
} }
#endif #endif
radio_set_operating_channel(24); uint8_t eeprom_channel;
uint8_t eeprom_check;
eeprom_channel = eeprom_read_byte(9);
eeprom_check = eeprom_read_byte(10);
if ((eeprom_channel < 11) || (eeprom_channel > 26) || ((uint8_t)eeprom_channel != (uint8_t)~eeprom_check)) {
eeprom_channel = 24; //Default
}
radio_set_operating_channel(eeprom_channel);
radio_use_auto_tx_crc(true); radio_use_auto_tx_crc(true);
radio_set_trx_state(TRX_OFF); radio_set_trx_state(TRX_OFF);