Tapton School Sentinel Project
Fork of SMARTGPU2 by
Revision 2:3ae3f28ae9fe, committed 2014-04-17
- Comitter:
- emmanuelchio
- Date:
- Thu Apr 17 21:17:00 2014 +0000
- Parent:
- 1:0bf6fac21233
- Child:
- 3:a57cfeb0185d
- Commit message:
- SmartGPU2 Official Mbed library V2.1, compatible with all smartGPU2 boards: 2.4", 3.5", 4.3" and 7.0" - Vizic Technologies 2014
Changed in this revision
SMARTGPU2.cpp | Show annotated file Show diff for this revision Revisions of this file |
SMARTGPU2.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SMARTGPU2.cpp Thu Apr 17 20:36:42 2014 +0000 +++ b/SMARTGPU2.cpp Thu Apr 17 21:17:00 2014 +0000 @@ -14,45 +14,41 @@ *********************************************************/ /******************************************************** - MBED SMARTGPU2 LIBRARY VERSION V2.0 + MBED SMARTGPU2 LIBRARY VERSION V2.1 IMPORTANT : This library is created for the MBED Software IDE ********************************************************/ #include "mbed.h" #include "SMARTGPU2.h" +/**********************USER MODIFABLE****************************/ /****************************************************************/ //Communication Functions(PLATFORM DEPENDENT) - MODIFY TO FIT YOUR PLATFORM IF DIFFERENT THAN MBED /****************************************************************/ //Sends a single character through the serial port(USART) -void putcharTX(char data){ - _serialSMARTGPU2.putc(data); -} +#define putcharTX(data) _serialSMARTGPU2.putc(data) //Returns a single character obtained from the serial port(USART) -char getcharRX(){ - return _serialSMARTGPU2.getc(); -} +#define getcharRX() _serialSMARTGPU2.getc() -//Changes/Sets a new Baudrate to the Host processor -void setBaud(unsigned long newBaud){ - _serialSMARTGPU2.baud(newBaud); -} +//Changes/Sets a new baudrate of the Host +#define setBaud(newBaud) _serialSMARTGPU2.baud(newBaud) -//Performs a Hardware Reset on smartGPU2 RESETPIN -void resetSmartGPU(){ //Reset the SMARTGPU2 board - _resetPin=GND; // set the pin to GND to reset - delay(500); - _resetPin=VCC; // set the pin to 5v to end reset - delay(500); -} +//Reset pin +#define resetHigh _resetPin=VCC // set the pin to 5v to end reset +#define resetLow _resetPin=GND // set the pin to GND to reset //MBED Exclusive - Hardware Configuration void SMARTGPU2::init(){ //configure the MBED board for SMARTGPU2 board setBaud(9600); - _resetPin=VCC; // set the pin to 5v to end reset + resetLow; // set the pin to GND to reset + delay(500); + resetHigh; // set the pin to 5v to end reset + delay(500); } - +/*********************END OF USER MODIFABLE**********************/ + +/*******************DON'T MODIFY UP FROM HERE********************/ /****************************************************************/ /****************************************************************/ /****************************************************************/ @@ -60,15 +56,18 @@ /****************************************************************/ /****************************************************************/ /****************************************************************/ - // SMART GPU2 DEFAULT BAUD RATE: 9600bps -//It should be used like this : SMARTGPU2 lcd(TXPIN,RXPIN,RESET); for serial communication with SMARTGPU2 +// SMART GPU2 DEFAULT BAUD RATE: 9600bps +//It should always be used like this : SMARTGPU2 lcd(TXPIN,RXPIN,RESET); for serial communication with SMARTGPU2 SMARTGPU2::SMARTGPU2(PinName TXPin, PinName RXPin, PinName resetPin): _serialSMARTGPU2(TXPin,RXPin), _resetPin(resetPin){ init(); } SMARTGPUREPLY SMARTGPU2::reset(){ //Physically Reset the SMARTGPU2 board - resetSmartGPU(); - return OK; + resetLow; // set the pin to GND to reset + delay(500); + resetHigh; // set the pin to 5v to end reset + delay(500); + return (SMARTGPUREPLY)OK; } SMARTGPUREPLY SMARTGPU2::start(){ //Init the SMARTGPU2 @@ -123,7 +122,7 @@ if(aux=='O'){ //if command is successfull, change baudrate, if not just leave and return 'F' delay(150); setBaud(baud); - delat(200); + delay(200); return (SMARTGPUREPLY)getcharRX(); }else{ return (SMARTGPUREPLY)aux;
--- a/SMARTGPU2.h Thu Apr 17 20:36:42 2014 +0000 +++ b/SMARTGPU2.h Thu Apr 17 21:17:00 2014 +0000 @@ -14,7 +14,7 @@ *********************************************************/ /******************************************************** - MBED SMARTGPU2 LIBRARY VERSION V2.0 + MBED SMARTGPU2 LIBRARY VERSION V2.1 IMPORTANT : This library is created for the MBED Software IDE ********************************************************/ @@ -26,7 +26,7 @@ /*******************USER MODIFABLE**********************/ //-Uncomment your preferred smartGPU2 board(only 1 at time)---------------- //#define LCD160X128 //SmartGPU2 1.8" connected via SmartSHIELD -//#define LCD320X240 //SmartGPU2 2.4" connected via SmartSHIELD +#define LCD320X240 //SmartGPU2 2.4" connected via SmartSHIELD //#define LCD480X320 //SmartGPU2 3.5" connected via SmartSHIELD //#define LCD480X272 //SmartGPU2 4.3" connected via SmartSHIELD //#define LCD800X480 //SmartGPU2 7.0" connected via SmartSHIELD @@ -37,7 +37,7 @@ //-SmartGPU2-MBED RESET PIN definition #define RESETPIN p15 //Define for the smartGPU2 RESET pin connected to the MBED board -//delay word compatibility for mbed +//delay word compatibility for mbed platform #define delay wait_ms /****************END OF USER MODIFABLE******************/ @@ -501,7 +501,7 @@ Serial _serialSMARTGPU2; DigitalOut _resetPin; - + }; #endif \ No newline at end of file