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.
display.h
00001 #include <stdint.h> 00002 // Define a macro to allow easy definition of colours 00003 // Format of colour value: <BGND 1 bit><Red 5 bits><Green 5 bits><Blue 5 bits> 00004 00005 #define SCREEN_WIDTH 240 00006 #define SCREEN_HEIGHT 320 00007 #define Y_TOUCH_MAX 1952 00008 #define Y_TOUCH_MIN 88 00009 #define X_TOUCH_MAX 1920 00010 #define X_TOUCH_MIN 112 00011 class Display { 00012 public: 00013 Display() {}; 00014 void begin(); 00015 void putPixel(uint16_t x, uint16_t y, uint16_t colour); 00016 void putImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *Image); 00017 void fillRectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t Colour); 00018 uint16_t RGBToWord(uint16_t R, uint16_t G, uint16_t B); 00019 void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t Colour); 00020 void drawRectangle(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t Colour); 00021 void drawCircle(uint16_t x0, uint16_t y0, uint16_t radius, uint16_t Colour); 00022 void fillCircle(uint16_t x0, uint16_t y0, uint16_t radius, uint16_t Colour); 00023 // Graphics text functions 00024 void print(const char *Text, uint16_t len, uint16_t x, uint16_t y, uint16_t ForeColour, uint16_t BackColour); 00025 void print(uint16_t Number, uint16_t x, uint16_t y, uint16_t ForeColour, uint16_t BackColour); 00026 int penDown(void); 00027 uint16_t readYTouch(void); 00028 uint16_t readXTouch(void); 00029 private: 00030 00031 void CommandMode(); 00032 void DataMode(); 00033 void LCD_Write_Cmd(uint8_t cmd); 00034 void LCD_Write_Data(uint8_t data); 00035 void resetDisplay(); 00036 void openAperture(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2); 00037 void drawLineLowSlope(uint16_t x0, uint16_t y0, uint16_t x1,uint16_t y1, uint16_t Colour); 00038 void drawLineHighSlope(uint16_t x0, uint16_t y0, uint16_t x1,uint16_t y1, uint16_t Colour); 00039 int iabs(int x) // simple integer version of abs for use by graphics functions 00040 { 00041 if (x < 0) 00042 return -x; 00043 else 00044 return x; 00045 } 00046 void initTouch(void); 00047 00048 00049 };
Generated on Sun Jul 17 2022 14:12:37 by
1.7.2