LCD lib
Fork of SMARTGPU2 by
Diff: SMARTGPU2.cpp
- Revision:
- 2:3ae3f28ae9fe
- Parent:
- 1:0bf6fac21233
- Child:
- 3:a57cfeb0185d
diff -r 0bf6fac21233 -r 3ae3f28ae9fe SMARTGPU2.cpp --- 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;