Contiki 3.x
menu.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 Swedish Institute of Computer Science
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in
12  * the documentation and/or other materials provided with the
13  * distribution.
14  * * Neither the name of the copyright holders nor the names of
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 /**
31  * \file
32  *
33  * \brief
34  * This file operates the menu flow chart described in the readme
35  * notes. This will create the proper commands needed to control the 1284p.
36  *
37  * \author
38  * Mike Vidales mavida404@gmail.com
39  *
40  */
41 
42 #ifndef MENU_H
43 #define MENU_H
44 
45 #include <avr/pgmspace.h>
46 #include <stdbool.h>
47 
48 /** \brief Pointer to function, used to dispatch a menu-driven function. See tmenu_item */
49 typedef void (*tmenufunc)(uint8_t *);
50 
51 /** \brief This structure defines the joystick operation within the menu_items[]. */
52 typedef struct {
53  const char * PROGMEM text; /**< Menu text to display. */
54  uint8_t left; /**< Contains next menu position for left. */
55  uint8_t right; /**< Contains next menu position for right. */
56  uint8_t up; /**< Contains next menu position for up. */
57  uint8_t down; /**< Contains next menu position for down. */
58  uint8_t *state; /**< State variable used as argument for menu enter function. */
59  tmenufunc enter_func; /**< Pointer to function to call when enter button is pressed. */
60 } tmenu_item;
61 
62 extern uint8_t ping_response;
63 extern bool ping_mode;
64 extern bool timeout_flag;
65 extern bool temp_flag;
66 extern bool auto_temp;
67 extern const PROGMEM tmenu_item menu_items[];
68 char top_menu_text[20];
69 
70 #define EEPROM_DEBUG_ADDR 0
71 
72 void menu_run_sleep(uint8_t *val);
73 void menu_run_doze(uint8_t *val);
74 void dectoascii(uint8_t val, char *str);
75 uint8_t *signed_dectoascii(int16_t n, uint8_t *str);
76 void eeprom_init(void);
77 void menu_ping_request(uint8_t * val);
78 uint8_t menu_send_ping(void);
79 void menu_stop_ping(void);
80 void menu_debug_mode(uint8_t *val);
81 void menu_read_temp(uint8_t *val);
82 void menu_display_temp(void);
83 void menu_clear_temp(void);
84 void menu_prepare_temp(uint8_t *val);
85 void menu_stop_temp(void);
86 void menu_send_temp(void);
87 
88 #endif /* MENU_H */
void menu_display_temp(void)
This will display the temperature in degrees F or C.
Definition: menu.c:374
void menu_ping_request(uint8_t *val)
This will setup a ping request command to the 1284p and reset the ping counter.
Definition: menu.c:264
uint8_t right
Contains next menu position for right.
Definition: menu.h:55
void menu_debug_mode(uint8_t *val)
This will enable or disable the JTAG debug interface to allow for proper temperature sensor readings...
Definition: menu.c:323
uint8_t left
Contains next menu position for left.
Definition: menu.h:54
tmenufunc enter_func
Pointer to function to call when enter button is pressed.
Definition: menu.h:59
uint8_t up
Contains next menu position for up.
Definition: menu.h:56
void menu_clear_temp(void)
This will clear the temperature displayed in the 4 digit LCD segments.
Definition: menu.c:406
void menu_stop_ping(void)
This will stop the ping request.
Definition: menu.c:309
uint8_t * signed_dectoascii(int16_t n, uint8_t *str)
This will convert a signed decimal number to ASCII.
Definition: menu.c:93
void menu_run_doze(uint8_t *val)
This will start a sleep with wakes for temperature measurement and web requests.
Definition: menu.c:215
const uint32_t OIDSupportedList[] PROGMEM
List of supported RNDIS OID&#39;s.
Definition: rndis.c:96
void menu_prepare_temp(uint8_t *val)
This will setup the current temperature for transfer to the ATmega1284p via a binary command transfer...
Definition: menu.c:424
uint8_t * state
State variable used as argument for menu enter function.
Definition: menu.h:58
void eeprom_init(void)
Initialize the EEPROM module.
Definition: eeprom.c:72
void dectoascii(uint8_t val, char *str)
This function will convert decimal to ascii.
Definition: menu.c:76
void menu_run_sleep(uint8_t *val)
This will start a sleep operation.
Definition: menu.c:165
uint8_t menu_send_ping(void)
This will send the ping request to the 1284p via the serial port.
Definition: menu.c:290
uint8_t down
Contains next menu position for down.
Definition: menu.h:57
void menu_read_temp(uint8_t *val)
This will display the temperature in degrees F or C.
Definition: menu.c:354
const char *PROGMEM text
Menu text to display.
Definition: menu.h:53
This structure defines the joystick operation within the menu_items[].
Definition: menu.h:52
void menu_stop_temp(void)
This will stop the auto sending of temperature data.
Definition: menu.c:444
void(* tmenufunc)(uint8_t *)
Pointer to function, used to dispatch a menu-driven function.
Definition: menu.h:49