diff --git a/platform/avr-ravenlcd/menu.c b/platform/avr-ravenlcd/menu.c index 56d41f030..c669f6251 100644 --- a/platform/avr-ravenlcd/menu.c +++ b/platform/avr-ravenlcd/menu.c @@ -39,6 +39,7 @@ * */ +#include #include "menu.h" #include "main.h" #include "lcd.h" @@ -131,6 +132,27 @@ uint8_t /*---------------------------------------------------------------------------*/ +/** + * \brief This will check for DEBUG mode after power up. +*/ +void +eeprom_init(void) +{ + uint8_t val; + if(0xFF == eeprom_read_byte(EEPROM_DEBUG_ADDR)){ + /* Disable - Reverse logic. */ + val = 1; + menu_debug_mode(&val); + } + else{ + /* Enable - Reverse logic. */ + val = 0; + menu_debug_mode(&val); + } +} + +/*---------------------------------------------------------------------------*/ + /** * \brief This will start a sleep operation. * @@ -252,16 +274,20 @@ menu_debug_mode(uint8_t *val) uint8_t sreg = SREG; cli(); if(*val){ - /* Could use inline ASM to meet timing requirements. */ + /* Disable - Could use inline ASM to meet timing requirements. */ MCUCR |= (1 << JTD); MCUCR |= (1 << JTD); /* Needed for timing critical JTD disable. */ temp_init(); + /* Store setting in EEPROM. */ + eeprom_write_byte(EEPROM_DEBUG_ADDR, 0xFF); } else{ - /* Could use inline ASM to meet timing requirements. */ + /* Enable - Could use inline ASM to meet timing requirements. */ MCUCR &= ~(1 << JTD); MCUCR &= ~(1 << JTD); + /* Store setting in EEPROM. */ + eeprom_write_byte(EEPROM_DEBUG_ADDR, 0x01); } SREG = sreg; } diff --git a/platform/avr-ravenlcd/menu.h b/platform/avr-ravenlcd/menu.h index 78a9279bc..caeef2407 100644 --- a/platform/avr-ravenlcd/menu.h +++ b/platform/avr-ravenlcd/menu.h @@ -66,9 +66,12 @@ extern bool temp_flag; extern bool auto_temp; extern const PROGMEM tmenu_item menu_items[]; +#define EEPROM_DEBUG_ADDR 0 + void menu_run_sleep(uint8_t *val); void dectoascii(uint8_t val, char *str); uint8_t *signed_dectoascii(int16_t n, uint8_t *str); +void eeprom_init(void); void menu_ping_request(uint8_t * val); uint8_t menu_send_ping(void); void menu_stop_ping(void); diff --git a/platform/avr-ravenlcd/raven3290.c b/platform/avr-ravenlcd/raven3290.c index a3ed6140f..43ad24a71 100644 --- a/platform/avr-ravenlcd/raven3290.c +++ b/platform/avr-ravenlcd/raven3290.c @@ -1,15 +1,19 @@ +/* + * \mainpage ATmega3290p LCD Driver Software for Raven +*/ /** - * \section ATmega3290p LCD Driver Software for Raven + * \image html raven.png + * \ingroup platform + * \defgroup lcdraven RZRAVEN LCD 3290p * - * - * \subsection intro_lcd LCD Introduction + * \section intro_lcd LCD Introduction * * This Raven LCD Driver application software was designed for a user interface * to the Contiki 6LoWPAN collaboration on board the ATmega3290p. The * LCD functionality uses the binary command set described in the release notes. * These binary commands can also be found in a list of main.h. * - * \subsection compile_lcd Compiling Raven LCD Driver + * \section compile_lcd Compiling Raven LCD Driver * * Raven LCD Driver can be compiled on the following platforms: * @@ -22,9 +26,8 @@ * required for GCC/avr-libc to recognize new devices. The avr-libc * webpage includes a concise guide on how to patch and build the AVR * toolchain. - * -# IAR EWB-AVR. is currently not supported. * - * \subsection fuses Board fuse settings + * \section fuses_lcd Board fuse settings * * The Raven LCD (3290p device) requires the proper fuse settings to function * properly. These settings have been summarized below: @@ -33,7 +36,7 @@ * -# High: 0x99 (JTAG and ISP enabled, No OCDEN or EEPROM saving required) * -# Low: 0xE2 (Use Int RC OSC - Start-up Time:6CK + 65ms) * - * \subsection notes Operation Release Notes + * \section notes_lcd Operation Release Notes * * After programming the Raven LCD 3290p with the proper image, you will be introduced to * the menu in the picture below: @@ -56,7 +59,13 @@ * to the webserver for Sensor Reading Data (Once or Auto). The webserver will * only update the html data when refreshed. * - * \subsection binary Binary Command Description + * More information about the operation of the Contiki 6LoWPAN system can be found + * at the \ref tutorialraven. + * + * More information about the 802.15.4 MAC designed for the Contiki 6LoWPAN system + * can be found at the \ref macdoc. + * + * \section binary_lcd Binary Command Description * * Using the binary commmand list described in main.h, the 3290p will contruct a binary * command serial frame to control the 1284p. An example command frame is contructed below: @@ -124,7 +133,18 @@ #include "menu.h" #include "temp.h" -/** \defgroup lcd LCD Functions and data +#include +#include +FUSES = + { + .low = 0xe2, + .high = 0x99, + .extended = 0xff, + }; + + +/** \ingroup lcdraven + \defgroup lcd LCD Functions and data * \{ */ @@ -277,6 +297,8 @@ main(void) uart_init(); + eeprom_init(); + temp_init(); timer_init(); diff --git a/platform/avr-ravenlcd/temp.c b/platform/avr-ravenlcd/temp.c index c617f72c2..a5604270a 100644 --- a/platform/avr-ravenlcd/temp.c +++ b/platform/avr-ravenlcd/temp.c @@ -40,7 +40,7 @@ #include "key.h" #include "temp.h" -#include +#include "lcd.h" /** * \addtogroup lcd diff --git a/platform/avr-ravenlcd/temp.h b/platform/avr-ravenlcd/temp.h index 2880bab87..df8c2b2ce 100644 --- a/platform/avr-ravenlcd/temp.h +++ b/platform/avr-ravenlcd/temp.h @@ -49,7 +49,7 @@ #define PROGMEM_DECLARE(x) x __attribute__((__progmem__)) -/** \addtogroup grNTC */ +/** \addtogroup lcd */ /** \{ */ /** Type used with \ref temp_get() to select temperature unit */ typedef enum {