Library for FTDI FT800, Support up to 512 x 512 pixel resolution.
Dependents: FT800-Demo-Sliders FT800-Clock FT800-Demo-Bitmap
Hardware
- Display TFT 4.3" 480 x 272 (RVT43ULFNWC03) by Riverdi
- Break Out Board 20 by Riverdi
- Cable FFC, 0.5mm pitch, 20 pin, 150 mm
Info
- FT800 - Display, Audio and Touch Graphics Controller IC
- FT801 - Capacitive Touch Enabled Display, Audio and Touch Controller IC
- FT800 Series Programmer Guide
Diff: FT800_Functions.cpp
- Revision:
- 5:b28ce8616b41
- Parent:
- 4:5bcc69cb157a
diff -r 5bcc69cb157a -r b28ce8616b41 FT800_Functions.cpp --- a/FT800_Functions.cpp Sun Dec 20 23:27:17 2020 +0000 +++ b/FT800_Functions.cpp Wed Dec 30 17:12:59 2020 +0000 @@ -181,6 +181,49 @@ thread_sleep_for(ms); // C, ThisThread::sleep_for(ms); C++ //old wait_ms(ms); } + +//------------------------------MEMORY RAM_G----------------------------------------- +// Write zero to a block of memory +//----------------------------------------------------------------------------------- +void FT800::writeMemZero(uint32_t ptr, uint32_t numb) +{ + Write32(RAM_CMD, CMD_MEMZERO); + Write32(RAM_CMD, ptr); + Write32(RAM_CMD, numb); +} + +//----------------------------------------------------------------------------------- +// Write value to a block of memory +//----------------------------------------------------------------------------------- +void FT800::writeMemSet(uint32_t ptr, uint32_t value, uint32_t numb) +{ + Write32(RAM_CMD, CMD_MEMSET); + Write32(RAM_CMD, ptr); + Write32(RAM_CMD, value); + Write32(RAM_CMD, numb); +} + +//----------------------------------------------------------------------------------- +// Copy block of memory +//----------------------------------------------------------------------------------- +void FT800::writeMemCpy(uint32_t dest, uint32_t source, uint32_t numb) +{ + Write32(RAM_CMD, CMD_MEMCPY); + Write32(RAM_CMD, dest); + Write32(RAM_CMD, source); + Write32(RAM_CMD, numb); +} + +//----------------------------------------------------------------------------------- +// Write block of memory +//----------------------------------------------------------------------------------- +void FT800::writeMemWrt(uint32_t ptr, uint32_t numb) +{ + //Write32(RAM_CMD, CMD_MEMWRITE); + //Write32(RAM_CMD, ptr); + //Write32(RAM_CMD, numb); +} + //----------------------------------------------------------------------------------- // Set Backlight brightness [0-128], 0 = off, 128 = brightness 100% //----------------------------------------------------------------------------------- @@ -697,7 +740,7 @@ //----------------------------------------------------------------------------------- // Scale command //----------------------------------------------------------------------------------- -void FT800::scale(int16_t sx,int16_t sy) +void FT800::scale(int16_t sx, int16_t sy) { Write32(RAM_CMD, CMD_SCALE); Write32(RAM_CMD, (int32_t)sx<<16); @@ -706,7 +749,7 @@ //----------------------------------------------------------------------------------- // Translate command //----------------------------------------------------------------------------------- -void FT800::translate(int16_t tx,int16_t ty) +void FT800::translate(int16_t tx, int16_t ty) { Write32(RAM_CMD, CMD_TRANSLATE); Write32(RAM_CMD, (int32_t)tx<<16); @@ -721,7 +764,15 @@ Write32(RAM_CMD, ((int32_t)a<<16)/360); } //----------------------------------------------------------------------------------- -// Load jpg command +// Inflate command NEW +//----------------------------------------------------------------------------------- +void FT800::inflate(uint32_t ptr) +{ + Write32(RAM_CMD, CMD_INFLATE); + Write32(RAM_CMD, ptr); +} +//----------------------------------------------------------------------------------- +// Load Image command. The default format for the image is RGB565. OPT_MONO - Format L8 //----------------------------------------------------------------------------------- void FT800::loadJpgCMD(uint32_t ptr, uint32_t opt) { @@ -731,7 +782,6 @@ } - //----------------------------------------------------------------------------------- // Assign Tag and Track given area for touch // all object in the given area will have the same tag - to prevent use tag mask @@ -1007,32 +1057,30 @@ Write16(RAM_CMD, 0); // align to 32 tagMask(0); } + //----------------------------------------------------------------------------------- -// Write graphic RAM with 1 byte per pixel +// Write graphic RAM_G with 1 byte per pixel //----------------------------------------------------------------------------------- -void FT800::writeGraphRAM8(uint32_t addr, const uint8_t data[], uint16_t lng) +void FT800::writeRAMG(uint32_t addr, const uint8_t data[], uint32_t lng) +{ + uint32_t i; + _ss = 0; + WriteAddress(addr, ADWRITE); + for(i = 0; i < lng; i++) _spi.write(data[i]); + _ss = 1; +} +//----------------------------------------------------------------------------------- +// Write graphic RAM with 2 bytes per pixel (uint_6t) +//----------------------------------------------------------------------------------- +void FT800::writeRAMG16(uint32_t addr, const uint16_t data[], uint16_t lng) { uint16_t i; _ss = 0; WriteAddress(addr, ADWRITE); - for(i=0; i<lng; i++) + for(i = 0; i < lng; i++) { - _spi.write( data[i] ); - } - _ss = 1; -} -//----------------------------------------------------------------------------------- -// Write graphic RAM with 2 bytes per pixel -//----------------------------------------------------------------------------------- -void FT800::writeGraphRAM16(uint32_t addr, const uint16_t data[], uint16_t lng) -{ - uint16_t i; - _ss = 0; - WriteAddress(addr, ADWRITE); - for(i=0; i<lng; i++) - { - _spi.write((data[i] & 0xFF00)>>8); - _spi.write( data[i] & 0x00FF); + _spi.write( data[i] & 0x00FF); // first byte //_spi.write((data[i] & 0xFF00)>>8); + _spi.write((data[i] & 0xFF00)>>8); // second byte //_spi.write( data[i] & 0x00FF); } _ss = 1; }