aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/Source/c_ui.iom
blob: 770b682495bec37a1f2e47fb4d65e4f8baa9d563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//
// Programmer      
//
// Date init       14.12.2004
//
// Reviser         $Author:: Dkandlun                                        $
//
// Revision date   $Date:: 10-06-08 9:26                                     $
//
// Filename        $Workfile:: c_ui.iom                                      $
//
// Version         $Revision:: 4                                             $
//
// Archive         $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/c_ui.i $
//
// Platform        C
//

#ifndef   CUI_IOM
#define   CUI_IOM

#define   pMapUi ((IOMAPUI*)(pHeaders[ENTRY_UI]->pIOMap))

enum
{
  DEVICETYPE_UNKNOWN,
  DEVICETYPE_NXT,
  DEVICETYPE_PHONE,
  DEVICETYPE_PC
};

// Various filenames without extension
#define   UI_NONVOLATILE      "NVConfig"      // Ui non volatile config filename
#define   UI_PROGRAM_DEFAULT  "Untitled"      // On brick programming default filename
#define   UI_PROGRAM_TEMP     "Program"       // On brick programming tmp filename
#define   UI_PROGRAM_READER   "RPGReader"     // On brick programming script reader filename
#define   UI_DATALOG_FILENAME "OBD_"          // On brick datalog filename
#define   UI_DATALOG_DEFAULT  "Untitled"      // On brick datalog default name
#define   UI_DATALOG_TEMP     "Tmp"           // On brick datalog tmp filename
#define   UI_STARTUP_SOUND    "! Startup"     // Sound file activated when the menu system starts up
#define   UI_KEYCLICK_SOUND   "! Click"       // Sound file activated when key pressed in the menu system
#define   UI_ATTENTION_SOUND  "! Attention"   // Sound file activated when incomming BT requests attention

// Various text strings
#define   UI_NAME_DEFAULT     "NXT"           // Default blue tooth name 
#define   UI_PINCODE_DEFAULT  "1234"          // Default blue tooth pin code
#define   UI_PINCODE_NONE_OUT "????"          // Fake pin code to deney outgoing request
#define   UI_PINCODE_NONE_IN  "????"          // Fake pin code to deney incomming request

// Constants related to Flags
enum
{
  UI_UPDATE                   = 0x01,         // W  - Make changes take effect
  UI_DISABLE_LEFT_RIGHT_ENTER = 0x02,         // RW - Disable left, right and enter button
  UI_DISABLE_EXIT             = 0x04,         // RW - Disable exit button
  UI_REDRAW_STATUS            = 0x08,         // W  - Redraw entire status line
  UI_RESET_SLEEP_TIMER        = 0x10,         // W  - Reset sleep timeout timer
  UI_EXECUTE_LMS_FILE         = 0x20,         // W  - Execute LMS file in "LMSfilename" (Try It)
  UI_BUSY                     = 0x40,         // R  - UI busy running or datalogging (popup disabled)
  UI_ENABLE_STATUS_UPDATE     = 0x80          // W  - Enable status line to be updated
};

// Constants related to State
enum
{
  INIT_DISPLAY,                               // RW - Init display and load font, menu etc.
  INIT_LOW_BATTERY,                           // R  - Low battery voltage at power on
  INIT_INTRO,                                 // R  - Display intro
  INIT_WAIT,                                  // RW - Wait for initialization end
  INIT_MENU,                                  // RW - Init menu system
  NEXT_MENU,                                  // RW - Next menu icons ready for drawing
  DRAW_MENU,                                  // RW - Execute function and draw menu icons
  TEST_BUTTONS,                               // RW - Wait for buttons to be pressed
  LEFT_PRESSED,                               // RW - Load selected function and next menu id
  RIGHT_PRESSED,                              // RW - Load selected function and next menu id
  ENTER_PRESSED,                              // RW - Load selected function and next menu id
  EXIT_PRESSED,                               // RW - Load selected function and next menu id
  CONNECT_REQUEST,                            // RW - Request for connection accept
  EXECUTE_FILE,                               // RW - Execute file in "LMSfilename"
  EXECUTING_FILE,                             // R  - Executing file in "LMSfilename"
  LOW_BATTERY,                                // R  - Low battery at runtime
  BT_ERROR                                    // R  - BT error
};

// Constants related to Button
enum
{
  BUTTON_NONE,                                // R  - Button inserted are executed
  BUTTON_LEFT,                                // W  - Insert left arrow button
  BUTTON_ENTER,                               // W  - Insert enter button
  BUTTON_RIGHT,                               // W  - Insert right arrow button
  BUTTON_EXIT                                 // W  - Insert exit button
};

// Constants related to BlueToothState
enum
{
  BT_STATE_VISIBLE            = 0x01,         // RW - BT visible
  BT_STATE_CONNECTED          = 0x02,         // RW - BT connected to something
  BT_STATE_OFF                = 0x04,         // RW - BT power off
  BT_ERROR_ATTENTION          = 0x08,         // W  - BT error attention
  BT_CONNECT_REQUEST          = 0x40,         // RW - BT get connect accept in progress
  BT_PIN_REQUEST              = 0x80          // RW - BT get pin code
};

typedef   struct
{
  MENU    *pMenu;                             // W  - Pointer to menu file
  UWORD   BatteryVoltage;                     // R  - Battery voltage in millivolts
  UBYTE   LMSfilename[FILENAME_LENGTH + 1];   // W  - LMS filename to execute (Try It)
  UBYTE   Flags;                              // RW - Update command flags  (flags enumerated above)
  UBYTE   State;                              // RW - UI state              (states enumerated above)
  UBYTE   Button;                             // RW - Insert button         (buttons enumerated above)
  UBYTE   RunState;                           // W  - VM Run state          (0 = stopped, 1 = running)
  UBYTE   BatteryState;                       // W  - Battery state         (0..4 capacity)
  UBYTE   BluetoothState;                     // W  - Bluetooth state       (0=on, 1=visible, 2=conn, 3=conn.visible, 4=off, 5=dfu)
  UBYTE   UsbState;                           // W  - Usb state             (0=disconnected, 1=connected, 2=working)
  UBYTE   SleepTimeout;                       // RW - Sleep timeout time    (min)
  UBYTE   SleepTimer;                         // RW - Sleep timer           (min)
  UBYTE   Rechargeable;                       // R  - Rechargeable battery  (0 = no, 1 = yes)
  UBYTE   Volume;                             // RW - Volume used in UI     (0 - 4)
  UBYTE   Error;                              // W  - Error code
  UBYTE   OBPPointer;                         // W  - Actual OBP step       (0 - 4)
  UBYTE   ForceOff;                           // W  - Force off             (> 0 = off)
}IOMAPUI;

#endif