for 522 mbed basic operate
Diff: DmTftIli9325.cpp
- Revision:
- 14:2db7065edbec
- Parent:
- 7:6cd8c36cbdb3
--- a/DmTftIli9325.cpp Fri Sep 18 14:59:13 2015 +0000 +++ b/DmTftIli9325.cpp Mon Oct 12 08:35:35 2015 +0000 @@ -9,17 +9,25 @@ THIS SOFTWARE IS SUPPLIED "AS IS" WITHOUT ANY WARRANTIES AND SUPPORT. DISPLAYMODULE ASSUMES NO RESPONSIBILITY OR LIABILITY FOR THE USE OF THE SOFTWARE. ********************************************************************************************/ + + //Tested on NUCLEO-F401RE, LPCXpresso11U68 platform. + #include "DmTftIli9325.h" -DmTftIli9325::DmTftIli9325(uint8_t wr, uint8_t cs, uint8_t dc, uint8_t rst) : DmTftBase(240, 320) { - _wr = wr; - _cs = cs; - _dc = dc; - _rst = rst; +#if defined (DM_TOOLCHAIN_ARDUINO) +DmTftIli9325::DmTftIli9325(uint8_t wr, uint8_t cs, uint8_t dc, uint8_t rst) : DmTftBase(240, 320) +#elif defined (DM_TOOLCHAIN_MBED) +DmTftIli9325::DmTftIli9325(PinName wr, PinName cs, PinName dc, PinName rst) : DmTftBase(240, 320) +#endif +{ + _wr = wr; + _cs = cs; + _dc = dc; + _rst = rst; } DmTftIli9325::~DmTftIli9325() { -#if defined (DM_TOOLCHAIN_MBED) +#if defined (DM_TOOLCHAIN_MBED) delete _pinRST; delete _pinCS; delete _pinWR; @@ -30,14 +38,15 @@ _pinWR = NULL; _pinDC = NULL; _virtualPortD = NULL; -#endif +#endif } void DmTftIli9325::writeBus(uint8_t data) { #if defined (DM_TOOLCHAIN_ARDUINO) PORTD = data; #elif defined (DM_TOOLCHAIN_MBED) - *_virtualPortD = data; + *_virtualPortD = data; + //if(data & 0x10) #endif pulse_low(_pinWR, _bitmaskWR); } @@ -109,23 +118,28 @@ pinMode(_wr, OUTPUT); pinMode(_dc,OUTPUT); #elif defined (DM_TOOLCHAIN_MBED) - _pinRST = new DigitalOut((PinName)_rst); - _pinCS = new DigitalOut((PinName)_cs); - _pinWR = new DigitalOut((PinName)_wr); - _pinDC = new DigitalOut((PinName)_dc); - _virtualPortD = new BusOut(D0, D1, D2, D3, D4, SPECIAL_D5, D6, D7); + _pinRST = new DigitalOut(_rst); + _pinCS = new DigitalOut(_cs); + _pinWR = new DigitalOut(_wr); + _pinDC = new DigitalOut(_dc); + _virtualPortD = new BusOut(D0, D1, D2, D3, D4, SPECIAL_D5, D6, D7); // LPC15XX_H #endif sbi(_pinRST, _bitmaskRST); + delay(5); cbi(_pinRST, _bitmaskRST); + delay(15); sbi(_pinRST, _bitmaskRST); sbi(_pinCS, _bitmaskCS); sbi(_pinWR, _bitmaskWR); + delay(15); cbi(_pinCS, _bitmaskCS); + + sendCommand(0xE5); sendData(0x78F0); sendCommand(0x01); sendData(0x0100); sendCommand(0x02); sendData(0x0700);