Contiki 2.5
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 */