FT81x Arduino Driver
FT81x.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <Arduino.h>
35 #include <SPI.h>
36 
37 #if (defined(__arm__) && defined(TEENSYDUINO))
38 #define FT81x_USE_TEENSY_DMA 1
39 #include "platforms/teensy/DmaSpi.h"
40 #endif
41 
42 #define FT81x_COLOR_RGB(r, g, b) (((uint32_t)(r) << 16) | ((uint32_t)(g) << 8) | (uint32_t)(b))
43 
44 #define FT81x_ROTATE_LANDSCAPE 0
45 #define FT81x_ROTATE_LANDSCAPE_INVERTED 1
46 #define FT81x_ROTATE_PORTRAIT 2
47 #define FT81x_ROTATE_PORTRAIT_INVERTED 3
48 #define FT81x_ROTATE_LANDSCAPE_MIRRORED 4
49 #define FT81x_ROTATE_LANDSCAPE_INVERTED_MIRRORED 5
50 #define FT81x_ROTATE_PORTRAIT_MIRRORED 6
51 #define FT81x_ROTATE_PORTRAIT_INVERTED_MIRRORED 7
52 
53 #if defined(ARDUINO_ARCH_ARC32)
54 #define FT81x_SPI_CLOCK_SPEED 16000000
55 #elif defined(ARDUINO_ARCH_SAM)
56 #define FT81x_SPI_CLOCK_SPEED 24000000
57 #elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__IMXRT1062__)
58 #define FT81x_SPI_CLOCK_SPEED 24000000
59 #elif defined(ESP8266) || defined(ESP32)
60 #define FT81x_SPI_CLOCK_SPEED 24000000
61 #else
62 #define FT81x_SPI_CLOCK_SPEED 8000000
63 #endif
64 
65 #ifndef FT81x_SPI_SETTINGS
66 #define FT81x_SPI_SETTINGS SPISettings(FT81x_SPI_CLOCK_SPEED, MSBFIRST, SPI_MODE0)
67 #endif
68 
69 #define FT81x_CMD_ACTIVE 0x000000
70 #define FT81x_CMD_STANDBY 0x410000
71 #define FT81x_CMD_SLEEP 0x420000
72 #define FT81x_CMD_PWRDOWN 0x430000
73 #define FT81x_CMD_CLKEXT 0x440000
74 #define FT81x_CMD_CLKINT 0x480000
75 #define FT81x_CMD_CLKSEL 0x610000
76 #define FT81x_CMD_RST_PULSE 0x680000
77 #define FT81x_CMD_PINDRIVE 0x700000
78 
79 #define FT81x_REG_ID 0x302000
80 #define FT81x_REG_FRAMES 0x302004
81 #define FT81x_REG_CLOCK 0x302008
82 #define FT81x_REG_FREQUENCY 0x30200C
83 #define FT81x_REG_RENDERMODE 0x302010
84 #define FT81x_REG_SNAPY 0x302014
85 #define FT81x_REG_SNAPSHOT 0x302018
86 #define FT81x_REG_SNAPFORMAT 0x30201C
87 #define FT81x_REG_CPURESET 0x302020
88 #define FT81x_REG_TAP_CRC 0x302024
89 #define FT81x_REG_TAP_MASK 0x302028
90 #define FT81x_REG_HCYCLE 0x30202C
91 #define FT81x_REG_HOFFSET 0x302030
92 #define FT81x_REG_HSIZE 0x302034
93 #define FT81x_REG_HSYNC0 0x302038
94 #define FT81x_REG_HSYNC1 0x30203C
95 #define FT81x_REG_VCYCLE 0x302040
96 #define FT81x_REG_VOFFSET 0x302044
97 #define FT81x_REG_VSIZE 0x302048
98 #define FT81x_REG_VSYNC0 0x30204C
99 #define FT81x_REG_VSYNC1 0x302050
100 #define FT81x_REG_DLSWAP 0x302054
101 #define FT81x_REG_ROTATE 0x302058
102 #define FT81x_REG_OUTBITS 0x30205C
103 #define FT81x_REG_DITHER 0x302060
104 #define FT81x_REG_SWIZZLE 0x302064
105 #define FT81x_REG_CSPREAD 0x302068
106 #define FT81x_REG_PCLK_POL 0x30206C
107 #define FT81x_REG_PCLK 0x302070
108 #define FT81x_REG_TAG_X 0x302074
109 #define FT81x_REG_TAG_Y 0x302078
110 #define FT81x_REG_TAG 0x30207C
111 #define FT81x_REG_VOL_PB 0x302080
112 #define FT81x_REG_VOL_SOUND 0x302084
113 #define FT81x_REG_SOUND 0x302088
114 #define FT81x_REG_PLAY 0x30208C
115 #define FT81x_REG_GPIO_DIR 0x302090
116 #define FT81x_REG_GPIO 0x302094
117 #define FT81x_REG_GPIOX_DIR 0x302098
118 #define FT81x_REG_GPIOX 0x30209C
119 #define FT81x_REG_INT_FLAGS 0x3020A8
120 #define FT81x_REG_INT_EN 0x3020AC
121 #define FT81x_REG_INT_MASK 0x3020B0
122 #define FT81x_REG_PLAYBACK_START 0x3020B4
123 #define FT81x_REG_PLAYBACK_LENGTH 0x3020B8
124 #define FT81x_REG_PLAYBACK_READPTR 0x3020BC
125 #define FT81x_REG_PLAYBACK_FREQ 0x3020C0
126 #define FT81x_REG_PLAYBACK_FORMAT 0x3020C4
127 #define FT81x_REG_PLAYBACK_LOOP 0x3020C8
128 #define FT81x_REG_PLAYBACK_PLAY 0x3020CC
129 #define FT81x_REG_PWM_HZ 0x3020D0
130 #define FT81x_REG_PWM_DUTY 0x3020D4
131 #define FT81x_REG_MACRO_0 0x3020D8
132 #define FT81x_REG_MACRO_1 0x3020DC
133 #define FT81x_REG_CMD_READ 0x3020F8
134 #define FT81x_REG_CMD_WRITE 0x3020FC
135 #define FT81x_REG_CMD_DL 0x302100
136 #define FT81x_REG_BIST_EN 0x302174
137 #define FT81x_REG_TRIM 0x302180
138 #define FT81x_REG_ANA_COMP 0x302184
139 #define FT81x_REG_SPI_WIDTH 0x302188
140 #define FT81x_REG_DATESTAMP 0x302564
141 #define FT81x_REG_CMDB_SPACE 0x302574
142 #define FT81x_REG_CMDB_WRITE 0x302578
143 #define FT81x_REG_MEDIAFIFO_READ 0x309014
144 #define FT81x_REG_MEDIAFIFO_WRITE 0x309018
145 
146 #define FT81x_RAM_G 0x000000
147 #define FT81x_ROM_FONT 0x1E0000
148 #define FT81x_ROM_FONT_ADDR 0x2FFFFC
149 #define FT81x_RAM_DL 0x300000
150 #define FT81x_RAM_REG 0x302000
151 #define FT81x_RAM_CMD 0x308000
152 
153 #define FT81x_DLSWAP_LINE 0x1
154 #define FT81x_DLSWAP_FRAME 0x2
155 
156 #define FT81x_BITMAP_LAYOUT_ARGB1555 0x1
157 #define FT81x_BITMAP_LAYOUT_ARGB4 0x6
158 #define FT81x_BITMAP_LAYOUT_RGB565 0x7
159 
160 #define FT81x_BITMAP_SIZE_NEAREST 0x0
161 #define FT81x_BITMAP_SIZE_BILINEAR 0x1
162 
163 #define FT81x_OPT_3D 0x0000
164 #define FT81x_OPT_FLAT 0x0100
165 #define FT81x_OPT_SIGNED 0x0100
166 #define FT81x_OPT_CENTERX 0x0200
167 #define FT81x_OPT_CENTERY 0x0400
168 #define FT81x_OPT_CENTER 0x0600
169 #define FT81x_OPT_RIGHTX 0x0800
170 #define FT81x_OPT_NOBACK 0x1000
171 #define FT81x_OPT_NOTICKS 0x2000
172 #define FT81x_OPT_NOHM 0x4000
173 #define FT81x_OPT_NOPOINTER 0x4000
174 #define FT81x_OPT_NOSECS 0x8000
175 #define FT81x_OPT_NOHANDS 0xC000
176 
177 #define FT81x_AUDIO_FORMAT_LINEAR 0x0
178 #define FT81x_AUDIO_FORMAT_ULAW 0x1
179 #define FT81x_AUDIO_FORMAT_ADPCM 0x2
180 
181 #define FT81x_SOUND_SILENCE 0x00
182 #define FT81x_SOUND_SQUARE_WAVE 0x01
183 #define FT81x_SOUND_SINE_WAVE 0x02
184 #define FT81x_SOUND_SAWTOOTH_WAVE 0x03
185 #define FT81x_SOUND_TRIANGLE_WAVE 0x04
186 #define FT81x_SOUND_BEEPING 0x05
187 #define FT81x_SOUND_ALARM 0x06
188 #define FT81x_SOUND_WARBLE 0x07
189 #define FT81x_SOUND_CAROUSEL 0x08
190 #define FT81x_SOUND_1_SHORT_PIP 0x10
191 #define FT81x_SOUND_2_SHORT_PIPS 0x11
192 #define FT81x_SOUND_3_SHORT_PIPS 0x12
193 #define FT81x_SOUND_4_SHORT_PIPS 0x13
194 #define FT81x_SOUND_5_SHORT_PIPS 0x14
195 #define FT81x_SOUND_6_SHORT_PIPS 0x15
196 #define FT81x_SOUND_7_SHORT_PIPS 0x16
197 #define FT81x_SOUND_8_SHORT_PIPS 0x17
198 #define FT81x_SOUND_9_SHORT_PIPS 0x18
199 #define FT81x_SOUND_10_SHORT_PIPS 0x19
200 #define FT81x_SOUND_11_SHORT_PIPS 0x1A
201 #define FT81x_SOUND_12_SHORT_PIPS 0x1B
202 #define FT81x_SOUND_13_SHORT_PIPS 0x1C
203 #define FT81x_SOUND_14_SHORT_PIPS 0x1D
204 #define FT81x_SOUND_15_SHORT_PIPS 0x1E
205 #define FT81x_SOUND_16_SHORT_PIPS 0x1F
206 #define FT81x_SOUND_DTMF_HASH 0x23
207 #define FT81x_SOUND_DTMF_STAR 0x2C
208 #define FT81x_SOUND_DTMF_0 0x30
209 #define FT81x_SOUND_DTMF_1 0x31
210 #define FT81x_SOUND_DTMF_2 0x32
211 #define FT81x_SOUND_DTMF_3 0x33
212 #define FT81x_SOUND_DTMF_4 0x34
213 #define FT81x_SOUND_DTMF_5 0x35
214 #define FT81x_SOUND_DTMF_6 0x36
215 #define FT81x_SOUND_DTMF_7 0x37
216 #define FT81x_SOUND_DTMF_8 0x38
217 #define FT81x_SOUND_DTMF_9 0x39
218 #define FT81x_SOUND_HARP 0x40
219 #define FT81x_SOUND_XYLOPHONE 0x41
220 #define FT81x_SOUND_TUBA 0x42
221 #define FT81x_SOUND_GLOCKENSPIEL 0x43
222 #define FT81x_SOUND_ORGAN 0x44
223 #define FT81x_SOUND_TRUMPET 0x45
224 #define FT81x_SOUND_PIANO 0x46
225 #define FT81x_SOUND_CHIMES 0x47
226 #define FT81x_SOUND_MUSIC_BOX 0x48
227 #define FT81x_SOUND_BELL 0x49
228 #define FT81x_SOUND_CLICK 0x50
229 #define FT81x_SOUND_SWITCH 0x51
230 #define FT81x_SOUND_COWBELL 0x52
231 #define FT81x_SOUND_NOTCH 0x53
232 #define FT81x_SOUND_HIHAT 0x54
233 #define FT81x_SOUND_KICKDRUM 0x55
234 #define FT81x_SOUND_POP 0x56
235 #define FT81x_SOUND_CLACK 0x57
236 #define FT81x_SOUND_CHACK 0x58
237 #define FT81x_SOUND_MUTE 0x60
238 #define FT81x_SOUND_UNMUTE 0x61
239 
240 #define ST7701_SWRESET 0x01
241 #define ST7701_RDDPM 0x0A
242 #define ST7701_RDDCOLMOD 0x0C
243 #define ST7701_RDDIM 0x0D
244 #define ST7701_RDDSM 0x0E
245 #define ST7701_RDDSDR 0x0F
246 #define ST7701_SLPIN 0x10
247 #define ST7701_SLPOUT 0x11
248 #define ST7701_PTLON 0x12
249 #define ST7701_NORON 0x13
250 #define ST7701_INVOFF 0x20
251 #define ST7701_INVON 0x21
252 #define ST7701_DISPOFF 0x28
253 #define ST7701_DISPON 0x29
254 #define ST7701_TEON 0x35
255 #define ST7701_MADCTL 0x36
256 #define ST7701_COLMOD 0x3A
257 #define ST7701_WRDISBV 0x51
258 #define ST7701_SDIR 0xC7
259 #define ST7701_RDID1 0xDA
260 #define ST7701_RDID2 0xDB
261 #define ST7701_RDID3 0xDC
262 
263 #define ST7701_CND2BKxSEL 0xFF
264 
265 #define ST7701_BK0_PVGAMCTRL 0xB0
266 #define ST7701_BK0_NVGAMCTRL 0xB1
267 #define ST7701_BK0_LNESET 0xC0
268 #define ST7701_BK0_PORCTRL 0xC1
269 #define ST7701_BK0_INVSEL 0xC2
270 #define ST7701_BK0_RGBCTRL 0xC3
271 #define ST7701_BK0_PARCTRL 0xC5
272 #define ST7701_BK0_SDIR 0xC7
273 
274 #define ST7701_BK1_VRHS 0xB0
275 #define ST7701_BK1_VCOM 0xB1
276 #define ST7701_BK1_VGHSS 0xB2
277 #define ST7701_BK1_TESTCMD 0xB3
278 #define ST7701_BK1_VGLS 0xB5
279 #define ST7701_BK1_PWCTLR1 0xB7
280 #define ST7701_BK1_PWCTLR2 0xB8
281 #define ST7701_BK1_SPD1 0xC1
282 #define ST7701_BK1_SPD2 0xC2
283 
284 #define ST7701_CMD2BKxSEL_NONE 0x00
285 #define ST7701_CMD2BK0SEL 0x10
286 #define ST7701_CMD2BK1SEL 0x11
287 
288 
291 class FT81x {
292  public:
299  FT81x(int8_t cs1, int8_t cs2, int8_t dc) : cs1(cs1), cs2(cs2), dc(dc) {}
300 
304  void begin();
305 
310  void sendCommand(const uint32_t cmd);
311 
317  uint8_t read8(const uint32_t address);
318 
324  uint16_t read16(const uint32_t address);
325 
331  uint32_t read32(const uint32_t address);
332 
338  void write8(const uint32_t address, const uint8_t data);
339 
345  void write16(const uint32_t address, const uint16_t data);
346 
352  void write32(const uint32_t address, const uint32_t data);
353 
358  void clear(const uint32_t color);
359 
367  void drawCircle(const int16_t x, const int16_t y, const uint8_t size, const uint32_t color);
368 
378  void drawRect(const int16_t x, const int16_t y, const uint16_t width, const uint16_t height, const uint8_t cornerRadius, const uint32_t color);
379 
380  // KTOME function for triangles
392  void drawTri(const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2, const int16_t x3, const int16_t y3, const uint32_t color, const uint32_t bgcolor);
393 
403  void drawLine(const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2, const uint8_t width, const uint32_t color);
404 
410  void beginLineStrip(const uint8_t width, const uint32_t color);
411 
417  void addVertex(const int16_t x, const int16_t y);
418 
424  void endLineStrip();
425 
434  void drawLetter(const int16_t x, const int16_t y, const uint8_t font, const uint32_t color, const uint8_t letter);
435 
445  void drawText(const int16_t x, const int16_t y, const uint8_t font, const uint32_t color, const uint16_t options, const char text[]);
446 
457  void drawBitmap(const uint32_t offset, const uint16_t x, const uint16_t y, const uint16_t width, const uint16_t height, const uint8_t scale, const uint8_t rot);
458 
469  void overlayBitmap(const uint32_t offset, const uint16_t x, const uint16_t y, const uint16_t width, const uint16_t height, const uint8_t scale, const uint8_t rot);
470 
479  void drawSpinner(const int16_t x, const int16_t y, const uint16_t style, const uint16_t scale, const uint32_t color);
480 
493  void drawButton(const int16_t x, const int16_t y, const int16_t width, const int16_t height, const uint8_t font, const uint32_t textColor, const uint32_t buttonColor, const uint16_t options, const char text[]);
494 
507  void drawClock(const int16_t x, const int16_t y, const int16_t radius, const uint32_t handsColor, const uint32_t backgroundColor, const uint16_t options, const uint16_t hours, const uint16_t minutes, const uint16_t seconds);
508 
522  void drawGauge(const int16_t x, const int16_t y, const int16_t radius, const uint32_t handsColor, const uint32_t backgroundColor, const uint16_t options, const uint8_t major, const uint8_t minor, const uint16_t value, const uint16_t range);
523 
533  void drawGradient(const int16_t x1, const int16_t y1, const uint32_t color1, const int16_t x2, const int16_t y2, const uint32_t color2);
534 
548  void drawScrollbar(const int16_t x, const int16_t y, const int16_t width, const int16_t height, const uint32_t foregroundColor, const uint32_t backgroundColor, const uint16_t options, const uint16_t value, const uint16_t size, const uint16_t range);
549 
562  void drawProgressbar(const int16_t x, const int16_t y, const int16_t width, const int16_t height, const uint32_t foregroundColor, const uint32_t backgroundColor, const uint16_t options, const uint16_t value, const uint16_t range);
563 
567  void beginDisplayList();
568 
572  void swapScreen();
573 
577  void waitForCommandBuffer();
578 
583  void setRotation(const uint8_t rotation);
584 
592  void writeGRAM(const uint32_t offset, const uint32_t size, const uint8_t data[], const bool useProgmem = true);
593 
601  void loadImage(const uint32_t offset, const uint32_t size, const uint8_t data[], const bool useProgmem = true);
602 
611  void playAudio(const uint32_t offset, const uint32_t size, const uint16_t sampleRate, const uint8_t format, const bool loop);
612 
617  bool isSoundPlaying();
618 
623  void setAudioVolume(const uint8_t volume);
624 
630  void setSound(const uint8_t effect, const uint8_t pitch);
631 
635  void playSound();
636 
640  void stopSound();
641 
647  uint8_t queryDisplay(const uint8_t cmd);
648 
649  protected:
650  int8_t cs1;
651  int8_t cs2;
652  int8_t dc;
653  uint16_t cmdWriteAddress = 0;
654 
655 #ifdef FT81x_USE_TEENSY_DMA
656  uint8_t dmaBuffer[8] = {0};
657  volatile uint8_t dmaBufferOut[8] = {0};
658 
659  DmaSpi::Transfer trx;
660  DmaSpi::Transfer trx2;
661 #endif
662 
666  void initFT81x();
667 
671  void initDisplay();
672 
679  void sendCommandToDisplay(const uint8_t cmd, const uint8_t numParams, const uint8_t *params);
680 
685  void cmd(const uint32_t cmd);
686 
691  void startCmd(const uint32_t cmd);
692 
697  void intermediateCmd(const uint32_t cmd);
698 
703  void endCmd(const uint32_t cmd);
704 
709  void increaseCmdWriteAddress(uint16_t delta);
710 
714  void updateCmdWriteAddress();
715 
720  void sendText(const char text[]);
721 
726  uint8_t initBitmapHandleForFont(uint8_t font);
727 
728 #if defined(__AVR__)
729 
734  uint8_t fetchFromProgmem(const uint8_t data[], const uint32_t i);
735 #endif
736 
737 #ifdef FT81x_USE_TEENSY_DMA
738  void waitForDMAReady();
739  void transferDMABuffer(const uint8_t size);
740 #endif
741 
742  private:
743 };
FT81x::clear
void clear(const uint32_t color)
Write clear command to current display list.
Definition: FT81x.cpp:247
FT81x::loadImage
void loadImage(const uint32_t offset, const uint32_t size, const uint8_t data[], const bool useProgmem=true)
Load image data (JPEG, PNG) as bitmap into general purpose graphics RAM (must be aligned to 4 bytes)
Definition: FT81x.cpp:500
FT81x::write8
void write8(const uint32_t address, const uint8_t data)
Write 8 bits to FT81x address space.
Definition: FT81x.cpp:933
FT81x::drawSpinner
void drawSpinner(const int16_t x, const int16_t y, const uint16_t style, const uint16_t scale, const uint32_t color)
Draw a spinner in current display list.
Definition: FT81x.cpp:429
FT81x::drawTri
void drawTri(const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2, const int16_t x3, const int16_t y3, const uint32_t color, const uint32_t bgcolor)
Draw triangle in current display list. Points must be defined in clockwise order. Only tested with eq...
Definition: FT81x.cpp:269
FT81x::read8
uint8_t read8(const uint32_t address)
Read 8 bits from FT81x address space.
Definition: FT81x.cpp:887
FT81x::setSound
void setSound(const uint8_t effect, const uint8_t pitch)
Set a sound effect and its pitch.
Definition: FT81x.cpp:563
FT81x::dc
int8_t dc
Data/Command pin for display.
Definition: FT81x.h:652
FT81x::intermediateCmd
void intermediateCmd(const uint32_t cmd)
Write an intermediate command to the command buffer of the FT81x chip during a bulk-write.
Definition: FT81x.cpp:854
FT81x::read32
uint32_t read32(const uint32_t address)
Read 32 bits from FT81x address space.
Definition: FT81x.cpp:916
FT81x::sendText
void sendText(const char text[])
Send text as the end of a command sequence.
Definition: FT81x.cpp:580
FT81x::cs1
int8_t cs1
CS pin for FT81x.
Definition: FT81x.h:650
FT81x::beginLineStrip
void beginLineStrip(const uint8_t width, const uint32_t color)
Start drawing a line strip.
Definition: FT81x.cpp:349
FT81x::increaseCmdWriteAddress
void increaseCmdWriteAddress(uint16_t delta)
Increase the internal pointer to the command buffer.
Definition: FT81x.cpp:576
FT81x::drawLine
void drawLine(const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2, const uint8_t width, const uint32_t color)
Draw line in current display list.
Definition: FT81x.cpp:340
FT81x::initDisplay
void initDisplay()
Initizalize the display.
Definition: FT81x.cpp:198
FT81x::endLineStrip
void endLineStrip()
End line strio.
Definition: FT81x.cpp:359
FT81x::endCmd
void endCmd(const uint32_t cmd)
Write a final command to the command buffer of the FT81x chip during a bulk-write.
Definition: FT81x.cpp:863
FT81x::drawLetter
void drawLetter(const int16_t x, const int16_t y, const uint8_t font, const uint32_t color, const uint8_t letter)
Draw a single letter in current display list.
Definition: FT81x.cpp:363
FT81x::overlayBitmap
void overlayBitmap(const uint32_t offset, const uint16_t x, const uint16_t y, const uint16_t width, const uint16_t height, const uint8_t scale, const uint8_t rot)
Overlay bitmap data (add pixel values to existing pixels)
Definition: FT81x.cpp:392
FT81x::drawCircle
void drawCircle(const int16_t x, const int16_t y, const uint8_t size, const uint32_t color)
Draw circle in current display list.
Definition: FT81x.cpp:252
FT81x::drawGauge
void drawGauge(const int16_t x, const int16_t y, const int16_t radius, const uint32_t handsColor, const uint32_t backgroundColor, const uint16_t options, const uint8_t major, const uint8_t minor, const uint16_t value, const uint16_t range)
Draw a gauge.
Definition: FT81x.cpp:459
FT81x::read16
uint16_t read16(const uint32_t address)
Read 16 bits from FT81x address space.
Definition: FT81x.cpp:901
FT81x::setAudioVolume
void setAudioVolume(const uint8_t volume)
Set the volume of the audio output.
Definition: FT81x.cpp:558
FT81x::swapScreen
void swapScreen()
End the current display list and swap the screen.
Definition: FT81x.cpp:540
FT81x::write16
void write16(const uint32_t address, const uint16_t data)
Write 16 bits to FT81x address space.
Definition: FT81x.cpp:945
FT81x::updateCmdWriteAddress
void updateCmdWriteAddress()
Write the internal pointer to the command buffer to the FT81x chip.
Definition: FT81x.cpp:578
FT81x::cs2
int8_t cs2
CS pin for display.
Definition: FT81x.h:651
FT81x::beginDisplayList
void beginDisplayList()
Begin a new display list.
Definition: FT81x.cpp:534
FT81x::initFT81x
void initFT81x()
Initialize the FT81x chip.
Definition: FT81x.cpp:144
FT81x::write32
void write32(const uint32_t address, const uint32_t data)
Write 32 bits to FT81x address space.
Definition: FT81x.cpp:958
FT81x::cmdWriteAddress
uint16_t cmdWriteAddress
Internal pointer to the command buffer of the FT81x chip.
Definition: FT81x.h:653
FT81x::drawClock
void drawClock(const int16_t x, const int16_t y, const int16_t radius, const uint32_t handsColor, const uint32_t backgroundColor, const uint16_t options, const uint16_t hours, const uint16_t minutes, const uint16_t seconds)
Draw an analog clock.
Definition: FT81x.cpp:448
FT81x::stopSound
void stopSound()
Stop audio output by playing silence.
Definition: FT81x.cpp:571
FT81x::playAudio
void playAudio(const uint32_t offset, const uint32_t size, const uint16_t sampleRate, const uint8_t format, const bool loop)
Play audio data located in general purpose graphics RAM (must be aligned to 8 bytes)
Definition: FT81x.cpp:518
FT81x::sendCommand
void sendCommand(const uint32_t cmd)
Send single command to FT81x chip.
Definition: FT81x.cpp:877
FT81x::drawScrollbar
void drawScrollbar(const int16_t x, const int16_t y, const int16_t width, const int16_t height, const uint32_t foregroundColor, const uint32_t backgroundColor, const uint16_t options, const uint16_t value, const uint16_t size, const uint16_t range)
Draw a scrollbar.
Definition: FT81x.cpp:478
FT81x::cmd
void cmd(const uint32_t cmd)
Write single command to the command buffer of the FT81x chip.
Definition: FT81x.cpp:527
FT81x::drawGradient
void drawGradient(const int16_t x1, const int16_t y1, const uint32_t color1, const int16_t x2, const int16_t y2, const uint32_t color2)
Draw a gradient.
Definition: FT81x.cpp:470
FT81x::drawButton
void drawButton(const int16_t x, const int16_t y, const int16_t width, const int16_t height, const uint8_t font, const uint32_t textColor, const uint32_t buttonColor, const uint16_t options, const char text[])
Draw a button.
Definition: FT81x.cpp:436
FT81x::startCmd
void startCmd(const uint32_t cmd)
Start a bulk-write to the command buffer of the FT81x chip.
Definition: FT81x.cpp:837
FT81x::drawText
void drawText(const int16_t x, const int16_t y, const uint8_t font, const uint32_t color, const uint16_t options, const char text[])
Draw a single line of text in current display list.
Definition: FT81x.cpp:415
FT81x::writeGRAM
void writeGRAM(const uint32_t offset, const uint32_t size, const uint8_t data[], const bool useProgmem=true)
Write data to general purpose graphics RAM (must be aligned to 4 bytes)
Definition: FT81x.cpp:813
FT81x::drawRect
void drawRect(const int16_t x, const int16_t y, const uint16_t width, const uint16_t height, const uint8_t cornerRadius, const uint32_t color)
Draw rectangle in current display list.
Definition: FT81x.cpp:260
FT81x::drawProgressbar
void drawProgressbar(const int16_t x, const int16_t y, const int16_t width, const int16_t height, const uint32_t foregroundColor, const uint32_t backgroundColor, const uint16_t options, const uint16_t value, const uint16_t range)
Draw a progressbar.
Definition: FT81x.cpp:489
FT81x::playSound
void playSound()
Play the sound defined by setSound()
Definition: FT81x.cpp:567
FT81x::isSoundPlaying
bool isSoundPlaying()
Query whether sound is currently playing.
Definition: FT81x.cpp:554
FT81x::drawBitmap
void drawBitmap(const uint32_t offset, const uint16_t x, const uint16_t y, const uint16_t width, const uint16_t height, const uint8_t scale, const uint8_t rot)
Draw bitmap data in current display list.
Definition: FT81x.cpp:371
FT81x::FT81x
FT81x(int8_t cs1, int8_t cs2, int8_t dc)
Initialize FT81x with hardware SPI.
Definition: FT81x.h:299
FT81x
Instatiate an FT81x context.
Definition: FT81x.h:291
FT81x::begin
void begin()
Initialize FT81x instance.
Definition: FT81x.cpp:115
FT81x::addVertex
void addVertex(const int16_t x, const int16_t y)
Add vertex to line strip.
Definition: FT81x.cpp:355
FT81x::sendCommandToDisplay
void sendCommandToDisplay(const uint8_t cmd, const uint8_t numParams, const uint8_t *params)
Send command to display.
Definition: FT81x.cpp:975
FT81x::setRotation
void setRotation(const uint8_t rotation)
Set screen rotation.
Definition: FT81x.cpp:552
FT81x::waitForCommandBuffer
void waitForCommandBuffer()
The command buffer can take 4 kBytes of data while display lists can hold 8 kBytes....
Definition: FT81x.cpp:545
FT81x::initBitmapHandleForFont
uint8_t initBitmapHandleForFont(uint8_t font)
Load and return the correct bitmap handle for fonts 16-34.
Definition: FT81x.cpp:613
FT81x::queryDisplay
uint8_t queryDisplay(const uint8_t cmd)
Query the display for data.
Definition: FT81x.cpp:991