LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
c_ui.c File Reference
#include "lms2012.h"
#include "c_ui.h"
#include "d_terminal.h"
#include "../../c_memory/source/c_memory.h"
#include "../../c_com/source/c_com.h"
#include "../../c_input/source/c_input.h"
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include "mindstorms.xbm"
#include "Ani1x.xbm"
#include "Ani2x.xbm"
#include "Ani3x.xbm"
#include "Ani4x.xbm"
#include "Ani5x.xbm"
#include "Ani6x.xbm"
#include "POP2.xbm"
#include "POP3.xbm"
#include "PCApp.xbm"
#include "keyboardc.xbm"
#include "keyboards.xbm"
#include "keyboardn.xbm"

Go to the source code of this file.

Macros

#define snprintf   _snprintf
 
#define CALL_INTERVAL   400
 
#define REAL_ANY_BUTTON   6
 
#define REAL_NO_BUTTON   7
 
#define SHUNT_IN   0.11
 
#define AMP_CIN   22.0
 
#define EP2_SHUNT_IN   0.05
 
#define EP2_AMP_CIN   15.0
 
#define SHUNT_OUT   0.055
 
#define AMP_COUT   19.0
 
#define VCE   0.05
 
#define AMP_VIN   0.5
 
#define AVR_CIN   300
 
#define AVR_COUT   30
 
#define AVR_VIN   30
 
#define CNT_V(C)   (((DATAF)C * (DATAF)ADC_REF) / ((DATAF)ADC_RES * (DATAF)1000.0))
 
#define TOP_BATT_ICONS   5
 
#define TOP_BT_ICONS   4
 
#define TOP_WIFI_ICONS   4
 
#define MAX_KEYB_DEEPT   3
 
#define MAX_KEYB_WIDTH   12
 
#define MAX_KEYB_HEIGHT   4
 

Functions

char * strptime (const char *s, const char *format, struct tm *tm)
 
void setUiInstance (UI_GLOBALS *_Instance)
 
UI_GLOBALSgetUiInstance ()
 
float new_bat_temp (float V_bat, float I_bat)
 
void cUiCheckTemp (void)
 
void cUiDownloadSuccesSound (void)
 
void cUiButtonClr (void)
 
void cUiButtonFlush (void)
 
void cUiSetLed (DATA8 State)
 
void cUiAlive (void)
 
RESULT cUiInit (void)
 
RESULT cUiOpen (void)
 
RESULT cUiClose (void)
 
RESULT cUiExit (void)
 
void cUiUpdateButtons (DATA16 Time)
 
RESULT cUiUpdateInput (void)
 
DATA8 cUiEscape (void)
 
void cUiTestpin (DATA8 State)
 
UBYTE AtoN (DATA8 Char)
 
void cUiFlushBuffer (void)
 
void cUiWriteString (DATA8 *pString)
 
DATA8 cUiButtonRemap (DATA8 Mapped)
 
void cUiSetPress (DATA8 Button, DATA8 Press)
 
DATA8 cUiGetPress (DATA8 Button)
 
DATA8 cUiTestShortPress (DATA8 Button)
 
DATA8 cUiGetShortPress (DATA8 Button)
 
DATA8 cUiGetBumbed (DATA8 Button)
 
DATA8 cUiTestLongPress (DATA8 Button)
 
DATA8 cUiGetLongPress (DATA8 Button)
 
DATA16 cUiTestHorz (void)
 
DATA16 cUiGetHorz (void)
 
DATA16 cUiGetVert (void)
 
DATA8 cUiWaitForPress (void)
 
DATA16 cUiAlignX (DATA16 X)
 
void cUiUpdateCnt (void)
 
void cUiUpdatePower (void)
 
void cUiUpdateTopline (void)
 
void cUiUpdateLcd (void)
 
void cUiRunScreen (void)
 
void cUiCheckVoltage (void)
 
void cUiCheckMemory (void)
 
void cUiCheckAlive (UWORD Time)
 
void cUiUpdate (UWORD Time)
 
DATA8 cUiNotification (DATA8 Color, DATA16 X, DATA16 Y, DATA8 Icon1, DATA8 Icon2, DATA8 Icon3, DATA8 *pText, DATA8 *pState)
 
DATA8 cUiQuestion (DATA8 Color, DATA16 X, DATA16 Y, DATA8 Icon1, DATA8 Icon2, DATA8 *pText, DATA8 *pState, DATA8 *pAnswer)
 
RESULT cUiIconQuestion (DATA8 Color, DATA16 X, DATA16 Y, DATA8 *pState, DATA32 *pIcons)
 
DATA8 cUiKeyboard (DATA8 Color, DATA16 X, DATA16 Y, DATA8 Icon, DATA8 Lng, DATA8 *pText, DATA8 *pCharSet, DATA8 *pAnswer)
 
void cUiDrawBar (DATA8 Color, DATA16 X, DATA16 Y, DATA16 X1, DATA16 Y1, DATA16 Min, DATA16 Max, DATA16 Act)
 
RESULT cUiBrowser (DATA8 Type, DATA16 X, DATA16 Y, DATA16 X1, DATA16 Y1, DATA8 Lng, DATA8 *pType, DATA8 *pAnswer)
 
DATA16 cUiTextboxGetLines (DATA8 *pText, DATA32 Size, DATA8 Del)
 
void cUiTextboxAppendLine (DATA8 *pText, DATA32 Size, DATA8 Del, DATA8 *pLine, DATA8 Font)
 
DATA32 cUiTextboxFindLine (DATA8 *pText, DATA32 Size, DATA8 Del, DATA16 Line, DATA8 *pFont)
 
void cUiTextboxReadLine (DATA8 *pText, DATA32 Size, DATA8 Del, DATA8 Lng, DATA16 Line, DATA8 *pLine, DATA8 *pFont)
 
RESULT cUiTextbox (DATA16 X, DATA16 Y, DATA16 X1, DATA16 Y1, DATA8 *pText, DATA32 Size, DATA8 Del, DATA16 *pLine)
 
void cUiGraphSetup (DATA16 StartX, DATA16 SizeX, DATA8 Items, DATA16 *pOffset, DATA16 *pSpan, DATAF *pMin, DATAF *pMax, DATAF *pVal)
 
void cUiGraphSample (void)
 
void cUiGraphDraw (DATA8 View, DATAF *pActual, DATAF *pLowest, DATAF *pHighest, DATAF *pAverage)
 
void cUiDraw (void)
 opUI_DRAW byte code More...
 
void cUiFlush (void)
 opUI_FLUSH byte code More...
 
void cUiRead (void)
 opUI_READ byte code More...
 
void cUiWrite (void)
 opUI_WRITE byte code More...
 
void cUiButton (void)
 opUI_BUTTON byte code More...
 
void cUiKeepAlive (void)
 opKEEP_ALIVE byte code More...
 

Variables

UI_GLOBALSgUiInstance
 
float R_bat_init = 0.63468
 
float heat_cap_bat = 136.6598
 
float K_bat_loss_to_elec = -0.0003
 
float K_bat_gain_from_elec = 0.001242896
 
float K_bat_to_room = -0.00012
 
float battery_power_boost = 1.7
 
float R_bat_neg_gain = 1.00
 
float K_elec_heat_slope = 0.0123175
 
float K_elec_loss_to_bat = -0.004137487
 
float K_elec_gain_from_bat = 0.002027574
 
float K_elec_to_room = -0.001931431
 
IMGDATA DownloadSuccesSound [] = { opINFO,LC0(GET_VOLUME),LV0(0),opSOUND,LC0(PLAY),LV0(0),LCS,'u','i','/','D','o','w','n','l','o','a','d','S','u','c','c','e','s',0,opSOUND_READY,opOBJECT_END }
 
DATA8 MappedToReal [BUTTONTYPES]
 
UBYTE TopLineBattIconMap [TOP_BATT_ICONS]
 
UBYTE TopLineBtIconMap [TOP_BT_ICONS]
 
UBYTE TopLineWifiIconMap [TOP_WIFI_ICONS]
 
const DATA8 FiletypeToNormalIcon [FILETYPES]
 

Macro Definition Documentation

#define AMP_CIN   22.0

Definition at line 1577 of file c_ui.c.

#define AMP_COUT   19.0

Definition at line 1583 of file c_ui.c.

#define AMP_VIN   0.5

Definition at line 1586 of file c_ui.c.

#define AVR_CIN   300

Definition at line 1588 of file c_ui.c.

#define AVR_COUT   30

Definition at line 1589 of file c_ui.c.

#define AVR_VIN   30

Definition at line 1590 of file c_ui.c.

#define CALL_INTERVAL   400

Definition at line 457 of file c_ui.c.

#define CNT_V (   C)    (((DATAF)C * (DATAF)ADC_REF) / ((DATAF)ADC_RES * (DATAF)1000.0))

Definition at line 1592 of file c_ui.c.

#define EP2_AMP_CIN   15.0

Definition at line 1580 of file c_ui.c.

#define EP2_SHUNT_IN   0.05

Definition at line 1579 of file c_ui.c.

#define MAX_KEYB_DEEPT   3

Definition at line 3277 of file c_ui.c.

#define MAX_KEYB_HEIGHT   4

Definition at line 3279 of file c_ui.c.

#define MAX_KEYB_WIDTH   12

Definition at line 3278 of file c_ui.c.

#define REAL_ANY_BUTTON   6

Definition at line 1163 of file c_ui.c.

#define REAL_NO_BUTTON   7

Definition at line 1164 of file c_ui.c.

#define SHUNT_IN   0.11

Definition at line 1576 of file c_ui.c.

#define SHUNT_OUT   0.055

Definition at line 1582 of file c_ui.c.

#define snprintf   _snprintf

Definition at line 199 of file c_ui.c.

#define TOP_BATT_ICONS   5

Definition at line 1702 of file c_ui.c.

#define TOP_BT_ICONS   4

Definition at line 1713 of file c_ui.c.

#define TOP_WIFI_ICONS   4

Definition at line 1723 of file c_ui.c.

#define VCE   0.05

Definition at line 1585 of file c_ui.c.

Function Documentation

UBYTE AtoN ( DATA8  Char)

Definition at line 1114 of file c_ui.c.

DATA16 cUiAlignX ( DATA16  X)

Definition at line 1570 of file c_ui.c.

void cUiAlive ( void  )

Definition at line 636 of file c_ui.c.

RESULT cUiBrowser ( DATA8  Type,
DATA16  X,
DATA16  Y,
DATA16  X1,
DATA16  Y1,
DATA8  Lng,
DATA8 pType,
DATA8 pAnswer 
)

Definition at line 3692 of file c_ui.c.

void cUiButton ( void  )

opUI_BUTTON byte code

Definition at line 7487 of file c_ui.c.

void cUiButtonClr ( void  )

Definition at line 578 of file c_ui.c.

void cUiButtonFlush ( void  )

Definition at line 589 of file c_ui.c.

DATA8 cUiButtonRemap ( DATA8  Mapped)

Definition at line 1181 of file c_ui.c.

void cUiCheckAlive ( UWORD  Time)

Definition at line 2441 of file c_ui.c.

void cUiCheckMemory ( void  )

Definition at line 2417 of file c_ui.c.

void cUiCheckTemp ( void  )

Definition at line 2376 of file c_ui.c.

void cUiCheckVoltage ( void  )

Definition at line 2128 of file c_ui.c.

RESULT cUiClose ( void  )

Definition at line 878 of file c_ui.c.

void cUiDownloadSuccesSound ( void  )

Definition at line 570 of file c_ui.c.

void cUiDraw ( void  )

opUI_DRAW byte code

Definition at line 5545 of file c_ui.c.

void cUiDrawBar ( DATA8  Color,
DATA16  X,
DATA16  Y,
DATA16  X1,
DATA16  Y1,
DATA16  Min,
DATA16  Max,
DATA16  Act 
)

Definition at line 3577 of file c_ui.c.

DATA8 cUiEscape ( void  )

Definition at line 1091 of file c_ui.c.

RESULT cUiExit ( void  )

Definition at line 898 of file c_ui.c.

void cUiFlush ( void  )

opUI_FLUSH byte code

Definition at line 6497 of file c_ui.c.

void cUiFlushBuffer ( void  )

Definition at line 1136 of file c_ui.c.

DATA8 cUiGetBumbed ( DATA8  Button)

Definition at line 1364 of file c_ui.c.

DATA16 cUiGetHorz ( void  )

Definition at line 1526 of file c_ui.c.

DATA8 cUiGetLongPress ( DATA8  Button)

Definition at line 1457 of file c_ui.c.

DATA8 cUiGetPress ( DATA8  Button)

Definition at line 1236 of file c_ui.c.

DATA8 cUiGetShortPress ( DATA8  Button)

Definition at line 1312 of file c_ui.c.

DATA16 cUiGetVert ( void  )

Definition at line 1543 of file c_ui.c.

void cUiGraphDraw ( DATA8  View,
DATAF pActual,
DATAF pLowest,
DATAF pHighest,
DATAF pAverage 
)

Definition at line 5130 of file c_ui.c.

void cUiGraphSample ( void  )

Definition at line 5076 of file c_ui.c.

void cUiGraphSetup ( DATA16  StartX,
DATA16  SizeX,
DATA8  Items,
DATA16 pOffset,
DATA16 pSpan,
DATAF pMin,
DATAF pMax,
DATAF pVal 
)

Definition at line 5031 of file c_ui.c.

RESULT cUiIconQuestion ( DATA8  Color,
DATA16  X,
DATA16  Y,
DATA8 pState,
DATA32 pIcons 
)

Definition at line 3113 of file c_ui.c.

RESULT cUiInit ( void  )

Definition at line 642 of file c_ui.c.

void cUiKeepAlive ( void  )

opKEEP_ALIVE byte code

Definition at line 7697 of file c_ui.c.

DATA8 cUiKeyboard ( DATA8  Color,
DATA16  X,
DATA16  Y,
DATA8  Icon,
DATA8  Lng,
DATA8 pText,
DATA8 pCharSet,
DATA8 pAnswer 
)

Definition at line 3281 of file c_ui.c.

DATA8 cUiNotification ( DATA8  Color,
DATA16  X,
DATA16  Y,
DATA8  Icon1,
DATA8  Icon2,
DATA8  Icon3,
DATA8 pText,
DATA8 pState 
)

Definition at line 2763 of file c_ui.c.

RESULT cUiOpen ( void  )

Definition at line 859 of file c_ui.c.

DATA8 cUiQuestion ( DATA8  Color,
DATA16  X,
DATA16  Y,
DATA8  Icon1,
DATA8  Icon2,
DATA8 pText,
DATA8 pState,
DATA8 pAnswer 
)

Definition at line 2979 of file c_ui.c.

void cUiRead ( void  )

opUI_READ byte code

Definition at line 6614 of file c_ui.c.

void cUiRunScreen ( void  )

Definition at line 1932 of file c_ui.c.

void cUiSetLed ( DATA8  State)

Definition at line 600 of file c_ui.c.

void cUiSetPress ( DATA8  Button,
DATA8  Press 
)

Definition at line 1198 of file c_ui.c.

DATA16 cUiTestHorz ( void  )

Definition at line 1509 of file c_ui.c.

DATA8 cUiTestLongPress ( DATA8  Button)

Definition at line 1412 of file c_ui.c.

void cUiTestpin ( DATA8  State)

Definition at line 1102 of file c_ui.c.

DATA8 cUiTestShortPress ( DATA8  Button)

Definition at line 1267 of file c_ui.c.

RESULT cUiTextbox ( DATA16  X,
DATA16  Y,
DATA16  X1,
DATA16  Y1,
DATA8 pText,
DATA32  Size,
DATA8  Del,
DATA16 pLine 
)

Definition at line 4851 of file c_ui.c.

void cUiTextboxAppendLine ( DATA8 pText,
DATA32  Size,
DATA8  Del,
DATA8 pLine,
DATA8  Font 
)

Definition at line 4721 of file c_ui.c.

DATA32 cUiTextboxFindLine ( DATA8 pText,
DATA32  Size,
DATA8  Del,
DATA16  Line,
DATA8 pFont 
)

Definition at line 4754 of file c_ui.c.

DATA16 cUiTextboxGetLines ( DATA8 pText,
DATA32  Size,
DATA8  Del 
)

Definition at line 4687 of file c_ui.c.

void cUiTextboxReadLine ( DATA8 pText,
DATA32  Size,
DATA8  Del,
DATA8  Lng,
DATA16  Line,
DATA8 pLine,
DATA8 pFont 
)

Definition at line 4806 of file c_ui.c.

void cUiUpdate ( UWORD  Time)

Definition at line 2464 of file c_ui.c.

void cUiUpdateButtons ( DATA16  Time)

Definition at line 931 of file c_ui.c.

void cUiUpdateCnt ( void  )

Definition at line 1595 of file c_ui.c.

RESULT cUiUpdateInput ( void  )

Definition at line 1036 of file c_ui.c.

void cUiUpdateLcd ( void  )

Definition at line 1912 of file c_ui.c.

void cUiUpdatePower ( void  )

Definition at line 1621 of file c_ui.c.

void cUiUpdateTopline ( void  )

Definition at line 1733 of file c_ui.c.

DATA8 cUiWaitForPress ( void  )

Definition at line 1560 of file c_ui.c.

void cUiWrite ( void  )

opUI_WRITE byte code

Definition at line 7115 of file c_ui.c.

void cUiWriteString ( DATA8 pString)

Definition at line 1149 of file c_ui.c.

UI_GLOBALS* getUiInstance ( )

Definition at line 209 of file c_ui.c.

float new_bat_temp ( float  V_bat,
float  I_bat 
)

Definition at line 252 of file c_ui.c.

void setUiInstance ( UI_GLOBALS _Instance)

Definition at line 204 of file c_ui.c.

char* strptime ( const char *  s,
const char *  format,
struct tm *  tm 
)

Variable Documentation

float battery_power_boost = 1.7

Definition at line 237 of file c_ui.c.

IMGDATA DownloadSuccesSound[] = { opINFO,LC0(GET_VOLUME),LV0(0),opSOUND,LC0(PLAY),LV0(0),LCS,'u','i','/','D','o','w','n','l','o','a','d','S','u','c','c','e','s',0,opSOUND_READY,opOBJECT_END }

Definition at line 568 of file c_ui.c.

const DATA8 FiletypeToNormalIcon[FILETYPES]
Initial value:
=
{
[FILETYPE_UNKNOWN] = ICON_FOLDER,
[TYPE_FOLDER] = ICON_FOLDER,
[TYPE_SOUND] = ICON_SOUND,
[TYPE_BYTECODE] = ICON_RUN,
[TYPE_GRAPHICS] = ICON_IMAGE,
[TYPE_DATALOG] = ICON_OBD,
[TYPE_PROGRAM] = ICON_OBP,
[TYPE_TEXT] = ICON_TEXT
}

Definition at line 2751 of file c_ui.c.

UI_GLOBALS* gUiInstance

Definition at line 202 of file c_ui.c.

float heat_cap_bat = 136.6598

Definition at line 229 of file c_ui.c.

float K_bat_gain_from_elec = 0.001242896

Definition at line 233 of file c_ui.c.

float K_bat_loss_to_elec = -0.0003

Definition at line 231 of file c_ui.c.

float K_bat_to_room = -0.00012

Definition at line 235 of file c_ui.c.

float K_elec_gain_from_bat = 0.002027574

Definition at line 246 of file c_ui.c.

float K_elec_heat_slope = 0.0123175

Definition at line 242 of file c_ui.c.

float K_elec_loss_to_bat = -0.004137487

Definition at line 244 of file c_ui.c.

float K_elec_to_room = -0.001931431

Definition at line 248 of file c_ui.c.

DATA8 MappedToReal[BUTTONTYPES]
Initial value:
=
{
[UP_BUTTON] = 0,
[ENTER_BUTTON] = 1,
[DOWN_BUTTON] = 2,
[RIGHT_BUTTON] = 3,
[LEFT_BUTTON] = 4,
[BACK_BUTTON] = 5,
[ANY_BUTTON] = REAL_ANY_BUTTON,
[NO_BUTTON] = REAL_NO_BUTTON
}
#define REAL_ANY_BUTTON
Definition: c_ui.c:1163
#define REAL_NO_BUTTON
Definition: c_ui.c:1164

Definition at line 1167 of file c_ui.c.

float R_bat_init = 0.63468

Definition at line 225 of file c_ui.c.

float R_bat_neg_gain = 1.00

Definition at line 239 of file c_ui.c.

UBYTE TopLineBattIconMap[TOP_BATT_ICONS]
Initial value:
=
{
SICON_BATT_0,
SICON_BATT_1,
SICON_BATT_2,
SICON_BATT_3,
SICON_BATT_4
}

Definition at line 1703 of file c_ui.c.

UBYTE TopLineBtIconMap[TOP_BT_ICONS]
Initial value:
=
{
SICON_BT_ON,
SICON_BT_VISIBLE,
SICON_BT_CONNECTED,
SICON_BT_CONNVISIB,
}

Definition at line 1714 of file c_ui.c.

UBYTE TopLineWifiIconMap[TOP_WIFI_ICONS]
Initial value:
=
{
SICON_WIFI_3,
SICON_WIFI_3,
SICON_WIFI_CONNECTED,
SICON_WIFI_CONNECTED,
}

Definition at line 1724 of file c_ui.c.