Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: dm_bubbles dm_calc dm_paint dm_sdcard_with_adapter ... more
DmTftRa8875.h
00001 /********************************************************************************************** 00002 Copyright (c) 2014 DisplayModule. All rights reserved. 00003 00004 Redistribution and use of this source code, part of this source code or any compiled binary 00005 based on this source code is permitted as long as the above copyright notice and following 00006 disclaimer is retained. 00007 00008 DISCLAIMER: 00009 THIS SOFTWARE IS SUPPLIED "AS IS" WITHOUT ANY WARRANTIES AND SUPPORT. DISPLAYMODULE ASSUMES 00010 NO RESPONSIBILITY OR LIABILITY FOR THE USE OF THE SOFTWARE. 00011 ********************************************************************************************/ 00012 00013 #ifndef DM_TFT_RA8875_h 00014 #define DM_TFT_RA8875_h 00015 00016 #include "DmTftBase.h" 00017 00018 enum RA8875Size { 00019 RA8875_480x272, 00020 RA8875_800x480 00021 }; 00022 00023 class DmTftRa8875 : public DmTftBase 00024 { 00025 public: 00026 #if defined (DM_TOOLCHAIN_ARDUINO) 00027 DmTftRa8875(uint8_t cs=D10, uint8_t sel=D9); 00028 #elif defined (DM_TOOLCHAIN_MBED) 00029 DmTftRa8875(PinName cs, PinName sel, PinName mosi, PinName miso, PinName clk); 00030 #endif 00031 virtual ~DmTftRa8875(); 00032 virtual void init(); 00033 void w25CtrlByRa8875(void); 00034 void w25CtrlByMCU(void); 00035 void clearScreen(uint16_t color = BLACK); 00036 00037 void setFontColor(uint16_t background,uint16_t foreground); 00038 void setFontZoom(uint8_t Hsize, uint8_t Vsize); 00039 void eableKeyScan(bool on); 00040 bool isKeyPress(void); 00041 uint8_t getKeyValue(void); 00042 void backlightOn(bool on); 00043 void backlightAdjust(uint8_t value); 00044 void drawImageContinuous(uint32_t startaddress, uint32_t count, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); 00045 void drawImageBlock(uint32_t startaddress, uint32_t count, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,uint16_t pic_width, uint16_t block_width, uint16_t block_height); 00046 uint16_t width(void); 00047 uint16_t height(void); 00048 void softReset(void); 00049 00050 void drawPoint(uint16_t x, uint16_t y, uint16_t radius=0); 00051 void drawNumber(uint16_t x, uint16_t y, int num, int digitsToShow, bool leadingZeros=false); 00052 void drawString(uint16_t x, uint16_t y, const char *p); 00053 void drawStringCentered(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const char *p); 00054 00055 void drawRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); 00056 void fillRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); 00057 00058 void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); 00059 void drawVerticalLine(uint16_t x, uint16_t y, uint16_t length, uint16_t color); 00060 void drawHorizontalLine(uint16_t x, uint16_t y, uint16_t length, uint16_t color); 00061 00062 void drawCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color); 00063 void fillCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color); 00064 00065 void drawTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color); 00066 void fillTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color); 00067 00068 void drawEllipse(int16_t x0, int16_t y0, int16_t longAxis, int16_t shortAxis, uint16_t color); 00069 void fillEllipse(int16_t x0, int16_t y0, int16_t longAxis, int16_t shortAxis, uint16_t color); 00070 00071 void drawCurve(int16_t x0, int16_t y0, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color); 00072 void fillCurve(int16_t x0, int16_t y0, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color); 00073 00074 void drawRoundRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t r1, uint16_t r2, uint16_t color); 00075 void fillRoundRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t r1, uint16_t r2, uint16_t color); 00076 private: 00077 void writeBus(uint8_t data); 00078 uint8_t readBus(void); 00079 virtual void sendCommand(uint8_t index); 00080 uint8_t readStatus(void); 00081 virtual void sendData(uint16_t data); 00082 void send8BitData(uint8_t data); 00083 uint8_t readData(void); 00084 virtual void writeReg(uint8_t reg, uint8_t val); 00085 uint8_t readReg(uint8_t reg); 00086 00087 void rectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color, bool filled); 00088 void circle(int16_t x, int16_t y, int16_t r, uint16_t color, bool filled); 00089 void triangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color, bool filled); 00090 void ellipse(int16_t x0, int16_t y0, int16_t longAxis, int16_t shortAxis, uint16_t color, bool filled); 00091 void curve(int16_t x0, int16_t y0, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color, bool filled); 00092 void roundrectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t r1, uint16_t r2, uint16_t color, bool filled); 00093 00094 virtual void setAddress(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); 00095 void int2str(int n, char *str); 00096 uint16_t _width; 00097 uint16_t _height; 00098 uint16_t _bgColor; 00099 uint16_t _fgColor; 00100 enum RA8875Size _size; 00101 00102 00103 #if defined (DM_TOOLCHAIN_ARDUINO) 00104 uint8_t _cs, _sel; 00105 regtype *_pinSEL; 00106 regsize _bitmaskSEL; 00107 uint8_t _spiSettings; 00108 #elif defined (DM_TOOLCHAIN_MBED) 00109 PinName _cs, _sel; 00110 DigitalOut *_pinSEL; 00111 SPI spi; 00112 #endif 00113 }; 00114 00115 #endif
Generated on Wed Jul 13 2022 04:21:40 by
1.7.2
DisplayModule 1.8" TFT with SPI Interface
DisplayModule 2.2" TFT with 8-bit interface
DisplayModule 2.8" 240x320 Touch TFT with 8-bit Interface
DisplayModule 2.4" 240x320 Touch TFT with 8-bit Interface
DisplayModule 2.8" 240x320 TFT LCD With Resistive Touch - SPI, 4MB Flash
DisplayModule 3.5" 320x240 TFT LCD With Resistive Touch - SPI, 4MB Flash
DisplayModule 4.3" 480x272 Arduino TFT Shield With Touch And SPI Interface
DisplayModule 5.0" 800x480 Arduino TFT Shield With Touch And SPI Interface
DisplayModule 2.8" 240x320 TFT With Capacitive Touch