4D display working with Gecko board STK3600

Dependents:   Genie_mbed_Gecko

Fork of 4dGENIE by christian b

Committer:
chris215
Date:
Fri Jul 04 02:44:49 2014 +0000
Revision:
6:f4d3977b0eae
Parent:
3:11c49c49cd1a
Child:
7:6edb20845684
Redesign of the 4dGENIE class. Right now, the class is only capable of writting to screen objects(excluding string objects)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris215 0:d2ed5a44c802 1 // Genie commands & replys:
chris215 0:d2ed5a44c802 2
chris215 0:d2ed5a44c802 3 #define GENIE_ACK 0x06
chris215 0:d2ed5a44c802 4 #define GENIE_NAK 0x15
chris215 0:d2ed5a44c802 5
chris215 0:d2ed5a44c802 6 #define TIMEOUT_PERIOD 500
chris215 0:d2ed5a44c802 7 #define RESYNC_PERIOD 100
chris215 0:d2ed5a44c802 8
chris215 0:d2ed5a44c802 9 #define GENIE_READ_OBJ 0
chris215 0:d2ed5a44c802 10 #define GENIE_WRITE_OBJ 1
chris215 0:d2ed5a44c802 11 #define GENIE_WRITE_STR 2
chris215 0:d2ed5a44c802 12 #define GENIE_WRITE_STRU 3
chris215 0:d2ed5a44c802 13 #define GENIE_WRITE_CONTRAST 4
chris215 0:d2ed5a44c802 14 #define GENIE_REPORT_OBJ 5
chris215 0:d2ed5a44c802 15 #define GENIE_REPORT_EVENT 7
chris215 0:d2ed5a44c802 16
chris215 0:d2ed5a44c802 17 // Objects
chris215 0:d2ed5a44c802 18 // the manual says:
chris215 0:d2ed5a44c802 19 // Note: Object IDs may change with future releases; it is not
chris215 0:d2ed5a44c802 20 // advisable to code their values as constants.
chris215 0:d2ed5a44c802 21
chris215 0:d2ed5a44c802 22 #define GENIE_OBJ_DIPSW 0
chris215 0:d2ed5a44c802 23 #define GENIE_OBJ_KNOB 1
chris215 0:d2ed5a44c802 24 #define GENIE_OBJ_ROCKERSW 2
chris215 0:d2ed5a44c802 25 #define GENIE_OBJ_ROTARYSW 3
chris215 0:d2ed5a44c802 26 #define GENIE_OBJ_SLIDER 4
chris215 0:d2ed5a44c802 27 #define GENIE_OBJ_TRACKBAR 5
chris215 0:d2ed5a44c802 28 #define GENIE_OBJ_WINBUTTON 6
chris215 0:d2ed5a44c802 29 #define GENIE_OBJ_ANGULAR_METER 7
chris215 0:d2ed5a44c802 30 #define GENIE_OBJ_COOL_GAUGE 8
chris215 0:d2ed5a44c802 31 #define GENIE_OBJ_CUSTOM_DIGITS 9
chris215 0:d2ed5a44c802 32 #define GENIE_OBJ_FORM 10
chris215 0:d2ed5a44c802 33 #define GENIE_OBJ_GAUGE 11
chris215 0:d2ed5a44c802 34 #define GENIE_OBJ_IMAGE 12
chris215 0:d2ed5a44c802 35 #define GENIE_OBJ_KEYBOARD 13
chris215 0:d2ed5a44c802 36 #define GENIE_OBJ_LED 14
chris215 0:d2ed5a44c802 37 #define GENIE_OBJ_LED_DIGITS 15
chris215 0:d2ed5a44c802 38 #define GENIE_OBJ_METER 16
chris215 0:d2ed5a44c802 39 #define GENIE_OBJ_STRINGS 17
chris215 0:d2ed5a44c802 40 #define GENIE_OBJ_THERMOMETER 18
chris215 0:d2ed5a44c802 41 #define GENIE_OBJ_USER_LED 19
chris215 0:d2ed5a44c802 42 #define GENIE_OBJ_VIDEO 20
chris215 0:d2ed5a44c802 43 #define GENIE_OBJ_STATIC_TEXT 21
chris215 0:d2ed5a44c802 44 #define GENIE_OBJ_SOUND 22
chris215 0:d2ed5a44c802 45 #define GENIE_OBJ_TIMER 23
chris215 0:d2ed5a44c802 46 #define GENIE_OBJ_SPECTRUM 24
chris215 0:d2ed5a44c802 47 #define GENIE_OBJ_SCOPE 25
chris215 0:d2ed5a44c802 48 #define GENIE_OBJ_TANK 26
chris215 0:d2ed5a44c802 49 #define GENIE_OBJ_USERIMAGES 27
chris215 0:d2ed5a44c802 50 #define GENIE_OBJ_PINOUTPUT 28
chris215 0:d2ed5a44c802 51 #define GENIE_OBJ_PININPUT 29
chris215 0:d2ed5a44c802 52 #define GENIE_OBJ_4DBUTTON 30
chris215 0:d2ed5a44c802 53 #define GENIE_OBJ_ANIBUTTON 31
chris215 0:d2ed5a44c802 54 #define GENIE_OBJ_COLORPICKER 32
chris215 0:d2ed5a44c802 55 #define GENIE_OBJ_USERBUTTON 33
chris215 0:d2ed5a44c802 56
chris215 0:d2ed5a44c802 57 // Structure to store replys returned from a display
chris215 0:d2ed5a44c802 58
chris215 0:d2ed5a44c802 59 #define GENIE_FRAME_SIZE 6
chris215 0:d2ed5a44c802 60
chris215 0:d2ed5a44c802 61 #define ERROR_NONE 0
chris215 0:d2ed5a44c802 62 #define ERROR_TIMEOUT -1 // 255 0xFF
chris215 0:d2ed5a44c802 63 #define ERROR_NOHANDLER -2 // 254 0xFE
chris215 0:d2ed5a44c802 64 #define ERROR_NOCHAR -3 // 253 0xFD
chris215 0:d2ed5a44c802 65 #define ERROR_NAK -4 // 252 0xFC
chris215 0:d2ed5a44c802 66 #define ERROR_REPLY_OVR -5 // 251 0xFB
chris215 0:d2ed5a44c802 67 #define ERROR_RESYNC -6 // 250 0xFA
chris215 0:d2ed5a44c802 68 #define ERROR_NODISPLAY -7 // 249 0xF9
chris215 0:d2ed5a44c802 69 #define ERROR_BAD_CS -8 // 248 0xF8
chris215 0:d2ed5a44c802 70
chris215 0:d2ed5a44c802 71 #define GENIE_LINK_IDLE 0
chris215 0:d2ed5a44c802 72 #define GENIE_LINK_WFAN 1 // waiting for Ack or Nak
chris215 0:d2ed5a44c802 73 #define GENIE_LINK_WF_RXREPORT 2 // waiting for a report frame
chris215 0:d2ed5a44c802 74 #define GENIE_LINK_RXREPORT 3 // receiving a report frame
chris215 0:d2ed5a44c802 75 #define GENIE_LINK_RXEVENT 4 // receiving an event frame
chris215 0:d2ed5a44c802 76 #define GENIE_LINK_SHDN 5
chris215 0:d2ed5a44c802 77
chris215 0:d2ed5a44c802 78 #define GENIE_EVENT_NONE 0
chris215 0:d2ed5a44c802 79 #define GENIE_EVENT_RXCHAR 1
chris215 0:d2ed5a44c802 80
chris215 0:d2ed5a44c802 81 #ifndef TRUE
chris215 0:d2ed5a44c802 82 #define TRUE (1==1)
chris215 0:d2ed5a44c802 83 #define FALSE (!TRUE)
chris215 0:d2ed5a44c802 84 #endif
chris215 0:d2ed5a44c802 85
chris215 2:f283764fe9b7 86 class Mbed4dGenie{
chris215 2:f283764fe9b7 87 public:
chris215 6:f4d3977b0eae 88 /*
chris215 6:f4d3977b0eae 89 Constructor to initialise the pins used to control the lcd screen
chris215 6:f4d3977b0eae 90 Note: When the class is first initialised, the lcd screen will be put
chris215 6:f4d3977b0eae 91 in reset and kept reset until Start() is called
chris215 6:f4d3977b0eae 92 */
chris215 3:11c49c49cd1a 93 Mbed4dGenie(PinName TxPin,PinName RxPin, PinName resetpin);
chris215 6:f4d3977b0eae 94 /*
chris215 6:f4d3977b0eae 95 Deassert the reset pin and give some time to the lcd to
chris215 6:f4d3977b0eae 96 initialise itself before sending any commands.
chris215 6:f4d3977b0eae 97 */
chris215 6:f4d3977b0eae 98 void Start();
chris215 6:f4d3977b0eae 99 /*
chris215 6:f4d3977b0eae 100 Generic command to write data to a Genie object
chris215 6:f4d3977b0eae 101 returns the status code of operation
chris215 6:f4d3977b0eae 102 */
chris215 6:f4d3977b0eae 103 int8_t genieWriteObject (uint16_t object, uint16_t index, uint16_t data);
chris215 2:f283764fe9b7 104
chris215 6:f4d3977b0eae 105 private:
chris215 6:f4d3977b0eae 106 /*
chris215 6:f4d3977b0eae 107 Wait for the screen to aknowledge the command
chris215 6:f4d3977b0eae 108 returns the status code of operation
chris215 6:f4d3977b0eae 109 */
chris215 6:f4d3977b0eae 110 int8_t WaitForAnswer();
chris215 6:f4d3977b0eae 111
chris215 6:f4d3977b0eae 112
chris215 6:f4d3977b0eae 113
chris215 2:f283764fe9b7 114 Serial _screen;
chris215 6:f4d3977b0eae 115 DigitalOut _reset;
chris215 2:f283764fe9b7 116 Timer _t;
chris215 6:f4d3977b0eae 117 };