![](/media/cache/profiles/9f0876a200701e5fdece2e58aa965574.jpg.50x50_q85.jpg)
Very simple program for FT800 graphic lib (using touchscreen - button, key and slider demo)
There is the only screen for touch screen functionality demonstration
Hardware
- TFT module uxTouch by Riverdi
- Break Out Board 20 by Riverdi
- Any mbed platform with I2C interface, SPI interface and 2 free GPIO for PD and INT signals
For documentation on the FT800 library, please refer to the respective library pages.
Connection
MCU-board is connected to TFT-module via Break Out Board. You need 6 signals to connect: SCK, MOSI and MISO are connected to a SPI channel, SS is the chip select signal, PD work as powerdown and INT for interrupts from TFT to MCU.
You have to connect VDD to BLVDD at Break Out Board if you use the board:
Проект для статьи "Как перестать бояться и полюбить mbed.[Часть 4]" См. https://habrahabr.ru/users/uuuulala/topics/
Revision 0:0b7d575ba7c8, committed 2016-09-23
- Comitter:
- Ksenia
- Date:
- Fri Sep 23 12:39:15 2016 +0000
- Commit message:
- Initial commit
Changed in this revision
diff -r 000000000000 -r 0b7d575ba7c8 FT800_2.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FT800_2.lib Fri Sep 23 12:39:15 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/FT800_2/#16e22c789f7d
diff -r 000000000000 -r 0b7d575ba7c8 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 23 12:39:15 2016 +0000 @@ -0,0 +1,59 @@ +#include "mbed.h" +#include "FT_Platform.h" + +// SLSTK3400A +FT800 TFT (PE10, PE11, PE12, PE13, PB11, PD4); // mosi, miso, sck, ss, int, pd +// WIZwiki-W7500P +//FT800 TFT (D11, D12, D13, D10, D9, D8); // mosi, miso, sck, ss, int, pd +// ATSAMD21-XPRO +//FT800 TFT (PA18, PA16, PA19, PA17, PA20, PA21); // mosi, miso, sck, ss, int, pd + +char sliderVal = 0; + +/***********************************************************************************************************************/ +/* Construct the screen and downloasd it to the TFT */ +void drawScreen() +{ + TFT.DLstart(); + TFT.DL(CLEAR_COLOR_RGB(255, 255, 255)); + TFT.DL(CLEAR(1, 1, 1)); + + TFT.FgColor(0xC1004D); + + TFT.Keys(27, 127, 271, 41, 29, 0, "123"); + + TFT.DL(TAG(1)); + TFT.Button(31, 32, 148, 57, 27, OPT_FLAT, "Button"); + + TFT.DL(TAG(2)); + TFT.Slider(244, 45, 161, 17, 0, sliderVal, 255); + + // track the touch screen + char pressedButton = TFT.Rd8(REG_TOUCH_TAG); + int pressedSlider = TFT.Rd32(REG_TRACKER); + if (pressedButton == 2) { + sliderVal = (pressedSlider >> 16) * 255 / 65536; + } + + TFT.DL(COLOR_RGB(0, 0, 0)); + TFT.Text(28, 213, 28, 0, "REG_TOUCH_TAG"); + TFT.Text(28, 237, 28, 0, "REG_TRACKER"); + TFT.Number(230, 237, 28, 0, pressedButton); + TFT.Number(230, 213, 28, 0, sliderVal); + + TFT.DL(DISPLAY()); + TFT.Swap(); + TFT.Flush_Co_Buffer(); + TFT.WaitCmdfifo_empty(); +} + +/***********************************************************************************************************************/ +/* Main function */ +int main() +{ + TFT.Calibrate(); + TFT.Track(244, 45, 161, 17, 2); + while(1) { + drawScreen(); + } +} \ No newline at end of file
diff -r 000000000000 -r 0b7d575ba7c8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Sep 23 12:39:15 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file