If you want a really easy way in to embedded GUI development, Geoff Graham is currently in the late stages of beta testing the Micromite+ (firmware available on the Backshed forum).
This is a PIC32MX470 loaded with a very sophisticated Basic interpreter that also allows calling compiled C routines where ultimate speed is required. The Micromite firmware includes support for a range of TFT displays including the SSD1963 and ILI9341 as well as support for their touch controllers and SDcards. I've attached a summary of the Basic commands for GUI development below. In addition there are all the usual drawing primitives BOX, CIRCLE, etc.
The combination of interpreted Basic with compiled C and extensive GUI support makes writing embedded applications very easy. Minimum hardware is the processor chip, a crystal, a resistor and a few capacitors. Once the Micromite firmware is programmed onto the MX470 then Basic programming is via a standard TTL UART or there is also on-chip support for USB.
Don't be put off by Basic. This is an incredibly powerful development environment for embedded applications and it is all FREE!!!
Demo of some of this on
https://www.youtube.com/watch?v=BkJ2WbzO6dI&feature=youtu.be______________________________________________________________________________________________________
The advanced graphics controls are:
Frame
GUI FRAME #ref, caption$, StartX, StartY, Width, Height, Colour
This will draw a frame which is a box with round corners and a caption. A frame does not respond to touch but
is useful when a group of controls need to be visually brought together. It can also used to surround a group of
radio buttons and MMBasic will arrange for the radio buttons surrounded by the frame to be exclusive – that is,
when one radio button is selected any other button that was selected and within the frame will be automatically
deselected.
LED
GUI LED #ref, caption$, CenterX, CenterY, Radius, Colour
This will draw an indicator light (it looks like a panel mounted LED). When its value is set to a non zero
number it will be illuminated and when it is set to zero it will be off (a dull version of its colour attribute). The
caption will be drawn to the right of the LED and will use the colours set by the COLOUR command. A LED
does not respond to touch.
Check Box
GUI CHECKBOX #ref, caption$, StartX, StartY, Size, Colour
This will draw a check box which is a small box with a caption. Both the height and width are specified with
the 'Size' parameter. When touched an X will be drawn inside the box to indicate that this option has been
selected and the control's value will be set to 1. When touched a second time the check mark will be removed
and the control's value will be zero. The caption will be drawn to the right of the Check Box and will use the
colours set by the COLOUR command.
Push Button
GUI BUTTON #ref, caption$, StartX, StartY, Width, Height, FColour, BColour
This will draw a momentary button which is a square switch with the caption on its face. When touched the
visual image of the button will appear to be depressed and the control's value will be 1. When the touch is
removed the value will revert to zero. Caption can be a single string with two captions separated by a |
character (eg, "UP|DOWN"). When the button is up the first string will be used and when pressed the second
will be used
Switch
GUI SWITCH #ref, caption$, StartX, StartY, Width, Height, FColour, BColour
This will draw a latching switch with the caption on its face. When touched the visual image of the button will
appear to be depressed and the control's value will be 1. When touched a second time the switch will be
released and the value will revert to zero. Caption can be a single string with two captions separated by a |
character (eg, "ON|OFF"). When this is used the switch will appear to be a toggle switch with each half of the
caption used to label each half of the toggle switch.
Radio Button
GUI RADIO #ref, caption$, CenterX, CenterY, Radius, Colour
This will draw a radio button with a caption. When touched the centre of the button will be illuminated to
indicate that this option has been selected and the control's value will be 1. When another radio button is
selected the mark on this button will be removed and its value will be zero. Radio buttons are grouped together
when surrounded by a frame and when one button in the group is selected all others in the group will be
deselected. If a frame is not used all buttons on the screen will be grouped together.
The caption will be drawn to the right of the button and will use the colours set by the COLOUR command.
Display Box
GUI DISPLAYBOX #ref, StartX, StartY, Width, Height, FColour, BColour
This will draw a box with rounded corners. Any text can be displayed in the box by using the CtrlVal(r) =
command. This is useful for displaying text, numbers and messages. This control does not respond to touch.
Text Box
GUI TEXTBOX #ref, StartX, StartY, Width, Height, FColour, BColour
This will draw a box with rounded corners. When the box is touched a QWERTY keyboard will appear on the
screen. Using this virtual keyboard any text can be entered into the box including upper/lower case letters,
numbers and any other characters in the ASCII character set. The new text will replace any text previously in
the box.
The value of the control can set to a string starting with two hash characters (##) and in that case the string
(without the leading two hash characters) will be displayed in the box with reduced brightness. This can be
used to give the user a hint as to what should be entered (called "ghost text"). Reading the value of the control
displaying ghost text will return an empty string. When the control is used normally the ghost text will vanish.
MMBasic will try to position the virtual keyboard on the screen so as to not obscure the text box that caused it
to appear. A pen down interrupt will be generated when the keyboard is deployed and a key up interrupt will
be generated when the Enter key is touched and the keyboard is hidden.
Number Box
GUI NUMBERBOX #ref, StartX, StartY, Width, Height, FColour, BColour
This will draw a box with rounded corners. When the box is touched a numeric keypad will appear on the
screen. Using this virtual keypad any number can be entered into the box including a floating point number in
exponential format. The new number will replace the number previously in the box.
Similar to the Text Box the value of the control can set to a literal string with two leading hash characters (eg,
"##Hint") and in that case the string (without the leading two characters) will be displayed in the box with
reduced brightness. Reading this will return zero and when the control is used normally the ghost text will
vanish.
MMBasic will try to position the virtual keypad on the screen so as to not obscure the number box that caused
it to appear. A pen down interrupt will be generated when the keypad is deployed and a key up interrupt will
be generated when the Enter key is touched and the keypad is hidden. Also, when the Enter key is touched the
entered number will be evaluated as a number and the NUMBERBOX control redrawn to display this number.
Spin Box
GUI SPINBOX #ref, StartX, StartY, Width, Height, FColour, BColour, Step,
Minimum, Maximum
This will draw a box with up/down icons on either end. When these icons are touched the number in the box
will be incremented or decremented by the 'StepValue', holding down the touch will repeat the step at a fast
rate. 'Minimum' and 'Maximum' set a limit on the value that can be entered. 'StepValue', 'Minimum' and
'Maximum' are optional and if not specified 'StepValue' will be 1 and there will be no limit on the number
entered. A pen down interrupt will be generated every time up/down is touched or when automatic repeat
occurs.
Caption
GUI CAPTION #ref, text$, StartX, StartY, Justify, FColour, BColour
This will draw a text string on the screen. 'Justify' is one or two letters where the first letter is the horizontal
justification around X and can be L, C or R for LEFT, CENTER, RIGHT and the second letter is the vertical
placement around Y and can be T, M or B for TOP, MIDDLE, BOTTOM. The default justification is left/top.
This command is similar to the basic drawing command TEXT, the difference being that MMBasic will
automatically dim this control if a keyboard or number pad is displayed.
If the colours are not specified this control will use the colours set by the COLOUR command.
Interacting with Controls
Using the following commands and functions the characteristics of the on screen controls can be changed and
their value retrieved.
? = CTRLVAL(#ref)
This is a function that will return the current value of a control. For controls like check boxes or switches it
will be the number one (true) indicating that the control has been selected by the user or zero (false) if not.
For controls that hold a number (eg, a SPINBOX) the value will be the number (normally a floating point
number). For controls that hold a string (eg, TEXTBOX) the value will be a string. For example:
PRINT "The number in the spin box is: " CTRLVAL(#10)
? CTRLVAL(#ref) =
This command will set the value of a control. For off/on controls like check boxes it will override any
touch input and can be used to depress/release switches, tick/untick check boxes, etc. A value of zero is off
or unchecked and non zero will turn the control on. For a LED it will cause the LED to be illuminated or
turned off. It can also be used to set the initial value of spin boxes, text boxes, etc. For example:
CTRLVAL(#10) = 12.4
? GUI FCOLOUR colour, #ref1 [, #ref2, #ref3, etc]
This will change the foreground colour of the specified controls to 'colour'. This is especially handy for a
LED which can change colour.
? GUI BCOLOUR colour, #ref1 [, #ref2, #ref3, etc]
This will change the background colour of the specified controls to 'colour'.
? = TOUCH(REF)
This is a function that will return the reference number of the control currently being touched. If no control
is currently being touched it will return zero.
? = TOUCH(LASTREF)
This is a function that will return the reference number of the control that was last touched.
? GUI DISABLE #ref1 [, #ref2, #ref3, etc]
This will disable the controls in the list. Disabled controls do not respond to touch and will be displayed
dimmed. The keyword ALL can be used as the argument and that will disable all controls. For example:
GUI DISABLE ALL
? GUI HIDE #ref1 [, #ref2, #ref3, etc]
This will hide the controls in the list. Hidden controls will not respond to touch and will be replaced on the
screen with the current background colour. The keyword ALL can be used as the argument.
GUI RESTORE #ref1 [, #ref2, #ref3, etc]
This will undo the effects of GUI DISABLE or GUI HIDE and restore the controls in the list to full
visibility and normal operation. The keyword ALL can be used as the argument for all controls.
? GUI REDRAW #ref1 [, #ref2, #ref3, etc]
Will redraw the controls on the screen. It is useful if the screen image has been corrupted. The keyword
ALL can be used as the argument for all controls.
? GUI DELETE #ref1 [, #ref2, #ref3, etc]
This will delete the controls in the list. This includes removing the image of the control from the screen
using the current background colour and freeing the memory used by the control. The keyword ALL can
be used as the argument and that will cause all controls to be deleted.
? GUI DEFAULT HIDDEN
GUI DEFAULT SHOW
This will set the default state of newly created controls to hidden (ie, they will not be displayed on the
screen until GUI RESTORE is used). This is useful when creating controls that will be later made visible
depending on the program logic. The SHOW setting can be used to restored the original behaviour.