Recently I've implemented lightweight header library to encapsulate interfacing with FTDI EVE chip, namely, FT800, in templated OO manner. It should compile in modern embedded x86/ARM toolchains, like ones Keil or C++ Builder have.
The idea is as follows - while your core framework provides standard IO bus interface, like mine esfwxe, via EseChannel templated abstract facade, the rest is done in modular manner by EVE library classes.
Short "What is this?" list:
- EsFtEveCore.h - the chip-core template class, which is responsible for instantiation and exposing chip-specific types related to memory region constants, chip control registers, known control commands, and common IO bus functionality, like special nested RAII classes for scoped write and read, as well as simplified wrappers for N-byte read and write, and 'HOST' - flavoured commands (see FT EVE Programming guide).
- EsFtEvePlatform.h - template class standing for Platform (i.e. board) specific implementations, based on Core and Metrics types. While the Core was described above, the Metrics type should define LCD-specific constants, as follows (I used TM035KBH11 LCD panel with resistive touchpad):
- The FT EVE have multiple co-processor engines on-board, like GPU, touchscreen, Audio, so for each engine, there is separate API template should be provided, if needed. If specific engine is not used in your project, specific dummy EsFtEveNullApi.h is provided with an empty class inside, which may be used as a stub template parameter.
- The final glue template class is defined EsFtEveHardware.h. It provides complete FT EVE hardware, which is built upon specific core, platform, GPU, and other APIs.
/// Complete EVE hardware platform template /// template < typename EveCoreT, typename EvePlatformApiT, typename EveGpuApiT, typename EveAudioApiT, typename EveTouchApiT > class EsFtEveHardware
Following is an example of how to "assemple" complete implementation for FTDI EVE FT800 chip. All FT800 API are used, so no NullApi include is necessary. Distinct FT800 - related definitions and APIs provided in files with FT800 suffixes. The IO bus concept is built using FTDI MPSSE upon EseChannel.h concept from my embedded library core. That's fine for PC-to-embedded tesbed, an may be wrapped around any bare-metal or RTOS-aware SPI driver.
FTDI EVE header library usage snippet.
EsFtMpsseSpiChannel chnl(spi); EsFtEveHwFT800 eve(chnl); chnl.init(); chnl.activate(); eve.apiPlatform.lcdReset(true); eve.apiPlatform.powerModeSet( EsFtEvePowerMode::On ); eve.apiPlatform.bklightLevelSet(0); eve.apiPlatform.lcdReset(false); eve.apiAudio.ssVolumeSet(255); eve.apiPlatform.bklightLevelSet(8); eve.apiGpu.cmdDlStart(); eve.apiGpu.cmd(CLEAR_COLOR_RGB(255,255,255)); eve.apiGpu.cmd(CLEAR_CST(1,1,1)); eve.apiGpu.cmd(COLOR_RGB(0,0,255)); eve.apiGpu.cmdTextDraw(160,120,28,OPT::CENTERX|OPT::CENTERY,(const esU8*)"Please, tap on a dot"); esU32 result = eve.apiGpu.cmdCalibrate(); eve.apiGpu.cmdLogoPlay(); eve.apiGpu.cmdWaitForCompletion(true); //< Special wait - read writePtr as well EsThread::sleep(2000); eve.apiGpu.dl(CLEAR_COLOR_RGB(0,0,128), true); eve.apiGpu.dl(CLEAR_CST(1,1,1)); eve.apiGpu.dl(COLOR_RGB(255,255,255)); eve.apiGpu.dlPrimitiveBegin(PRIMITIVE::BITMAPS); eve.apiGpu.dl(VERTEX2II(160, 110, 31, 'F')); eve.apiGpu.dl(VERTEX2II(184, 110, 31, 'T')); eve.apiGpu.dl(VERTEX2II(210, 110, 31, 'D')); eve.apiGpu.dl(VERTEX2II(239, 110, 31, 'I')); eve.apiGpu.dlPrimitiveEnd(); eve.apiGpu.dl(COLOR_RGB(160, 22, 22)); // change color to red eve.apiGpu.dl(POINT_SIZE(320)); // set point size to 20 pixels in radius eve.apiGpu.dlPrimitiveBegin(PRIMITIVE::POINTS); // start drawing points eve.apiGpu.dl(VERTEX2II(100, 133, 0, 0)); // red point eve.apiGpu.dlPrimitiveEnd(); eve.apiGpu.dlDisplay(); eve.apiGpu.dlSwap(DLSWAP::FRAME); //< Swap on next frame
The FTDI EVE headers are available for download here: