Escrevendo um sinal analógico ( Seno e Cosseno) no display TFT

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MCUFRIEND_kbv.h Source File

MCUFRIEND_kbv.h

00001 // link:
00002 // https://os.mbed.com/users/davidprentice/code/Nucleo_dir_L152//file/d88d2ad55fac/main.cpp/
00003 // Committer: davidprentice
00004 // Date:      19 months ago
00005 // 2021-04-21
00006 //
00007 // MCUFRIEND_kbv.h
00008 //
00009 
00010 /*
00011  * MCUFRIEND_kbv class inherits from Adafruit_GFX class and the Arduino Print class.
00012  * Any use of MCUFRIEND_kbv class and examples is dependent on Adafruit and Arduino licenses
00013  * The license texts are in the accompanying license.txt file
00014  */
00015  
00016 #ifndef MCUFRIEND_KBV_H_
00017 #define MCUFRIEND_KBV_H_   299
00018  
00019 //#define USE_SERIAL
00020  
00021 #if ARDUINO < 101
00022 #define USE_GFX_KBV
00023 #include "ADA_GFX_kbv.h"
00024 #else
00025 #include "Adafruit_GFX.h"
00026 #endif
00027  
00028 class MCUFRIEND_kbv : public Adafruit_GFX {
00029  
00030     public:
00031 //  MCUFRIEND_kbv(int CS=A3, int RS=A2, int WR=A1, int RD=A0, int RST=A4); //shield wiring
00032     MCUFRIEND_kbv(int CS=0, int RS=0, int WR=0, int RD=0, int _RST=0);  //dummy arguments 
00033     void     reset(void);                                       // you only need the constructor
00034     void     begin(uint16_t ID = 0x9341);                       // you only need the constructor
00035     virtual void     drawPixel(int16_t x, int16_t y, uint16_t color);  // and these three
00036     void     WriteCmdData(uint16_t cmd, uint16_t dat);                 // ?public methods !!!
00037     void     pushCommand(uint16_t cmd, uint8_t * block, int8_t N);
00038     uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3); }
00039     uint16_t readID(void);
00040     virtual void     fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
00041     virtual void     drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { fillRect(x, y, 1, h, color); }
00042     virtual void     drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) { fillRect(x, y, w, 1, color); }
00043     virtual void     fillScreen(uint16_t color)                                     { fillRect(0, 0, _width, _height, color); }
00044     virtual void     setRotation(uint8_t r);
00045     virtual void     invertDisplay(boolean i);
00046  
00047     uint16_t readReg(uint16_t reg, int8_t index=0);
00048     int16_t  readGRAM(int16_t x, int16_t y, uint16_t *block, int16_t w, int16_t h);
00049     uint16_t readPixel(int16_t x, int16_t y) { uint16_t color; readGRAM(x, y, &color, 1, 1); return color; }
00050     void     setAddrWindow(int16_t x, int16_t y, int16_t x1, int16_t y1);
00051     void     pushColors(uint16_t *block, int16_t n, bool first);
00052     void     pushColors(uint8_t *block, int16_t n, bool first);
00053     void     pushColors(const uint8_t *block, int16_t n, bool first, bool bigend = false);
00054     void     vertScroll(int16_t top, int16_t scrollines, int16_t offset);
00055  
00056     protected:
00057     uint32_t readReg32(uint16_t reg);
00058     uint32_t readReg40(uint16_t reg);
00059     uint16_t  _lcd_xor, _lcd_capable;
00060  
00061     private:
00062     uint16_t _lcd_ID, _lcd_rev, _lcd_madctl, _lcd_drivOut, _MC, _MP, _MW, _SC, _EC, _SP, _EP;
00063 };
00064  
00065 // New color definitions.  thanks to Bodmer
00066 #define TFT_BLACK       0x0000      /*   0,   0,   0 */
00067 #define TFT_NAVY        0x000F      /*   0,   0, 128 */
00068 #define TFT_DARKGREEN   0x03E0      /*   0, 128,   0 */
00069 #define TFT_DARKCYAN    0x03EF      /*   0, 128, 128 */
00070 #define TFT_MAROON      0x7800      /* 128,   0,   0 */
00071 #define TFT_PURPLE      0x780F      /* 128,   0, 128 */
00072 #define TFT_OLIVE       0x7BE0      /* 128, 128,   0 */
00073 #define TFT_LIGHTGREY   0xC618      /* 192, 192, 192 */
00074 #define TFT_DARKGREY    0x7BEF      /* 128, 128, 128 */
00075 #define TFT_BLUE        0x001F      /*   0,   0, 255 */
00076 #define TFT_GREEN       0x07E0      /*   0, 255,   0 */
00077 #define TFT_CYAN        0x07FF      /*   0, 255, 255 */
00078 #define TFT_RED         0xF800      /* 255,   0,   0 */
00079 #define TFT_MAGENTA     0xF81F      /* 255,   0, 255 */
00080 #define TFT_YELLOW      0xFFE0      /* 255, 255,   0 */
00081 #define TFT_WHITE       0xFFFF      /* 255, 255, 255 */
00082 #define TFT_ORANGE      0xFDA0      /* 255, 180,   0 */
00083 #define TFT_GREENYELLOW 0xB7E0      /* 180, 255,   0 */
00084 #define TFT_PINK        0xFC9F
00085  
00086 #endif
00087  
00088