4D display working with Gecko board STK3600
Fork of 4dGENIE by
Diff: mbed_genie.h
- Revision:
- 2:f283764fe9b7
- Parent:
- 1:95e0e194a412
- Child:
- 3:11c49c49cd1a
--- a/mbed_genie.h Fri Feb 21 02:47:32 2014 +0000 +++ b/mbed_genie.h Sun Feb 23 01:34:05 2014 +0000 @@ -134,3 +134,62 @@ extern uint16_t genieWriteStr (uint16_t index, char *string); extern void genieWriteContrast (uint16_t value); +class Mbed4dGenie{ + public: + Mbed4dGenie(PinName TxPin,PinName RxPin); + void genieAttachEventHandler (genieUserEventHandlerPtr handler); + + uint8_t _genieGetchar(void); + void _geniePutchar (uint8_t c); + uint16_t _genieGetLinkState (void); + void _genieSetLinkState (uint16_t newstate); + bool _genieEnqueueEvent (uint8_t * data); + uint16_t genieWriteStrU (uint16_t index, char *string); + uint16_t genieWriteStr (uint16_t index, char *string); + int _genieWriteStrX (uint16_t code, uint16_t index, char *string); + void genieWriteContrast (uint16_t value); + uint16_t genieWriteObject (uint16_t object, uint16_t index, uint16_t data); + void _genieWaitForIdle (void); + bool genieDequeueEvent(genieFrame * buff); + uint16_t genieGetEventData (genieFrame * e); + bool genieEventIs(genieFrame * e, uint8_t cmd, uint8_t object, uint8_t index); + void _geniePushLinkState (uint8_t newstate); + void _geniePopLinkState (void); + void _genieFlushSerialInput(void); + void _handleError (void); + void _genieFlushEventQueue(void); + bool GenieReadable(void); + uint16_t genieDoEvents (void); + + private: + void RxIrqHandler(void); + Serial _screen; + Timer _t; + ////////////////////////////////////////////////////////////// + // Pointer to the user's event handler function + // + genieUserEventHandlerPtr _genieUserHandler; + ////////////////////////////////////////////////////////////// + // A structure to hold up to MAX_GENIE_EVENTS events receive + // from the display + // + genieEventQueueStruct _genieEventQueue; + ////////////////////////////////////////////////////////////// + // Simple 5-deep stack for the link state, this allows + // genieDoEvents() to save the current state, receive a frame, + // then restore the state + // + uint8_t _genieLinkStates[5]; + // + // Stack pointer + // + uint8_t *_genieLinkState; + ////////////////////////////////////////////////////////////// + // Number of mS the genieGetChar() function will wait before + // giving up on the display + int _genieTimeout; + ////////////////////////////////////////////////////////////// + // Global error variable + int _genieError; + uint8_t rxframe_count; + };