Maxint R&D
/
RETRO_LCD_PerformanceTest
Simple program for the RETRO to compare the performance of the DisplayN18 and LCD_ST7735 libraries.
Embed:
(wiki syntax)
Show/hide line numbers
DisplayN18.h
00001 #include "mbed.h" 00002 00003 #pragma once 00004 00005 class DisplayN18 { 00006 static const unsigned char STEP = 4; 00007 00008 DigitalOut resetPin; 00009 DigitalOut backlightPin; 00010 DigitalOut rsPin; 00011 DigitalOut csPin; 00012 SPI spi; 00013 00014 void writeCommand(unsigned char command); 00015 void writeData(unsigned char data); 00016 void writeData(const unsigned char* data, unsigned int length); 00017 00018 void reset(); 00019 void initialize(); 00020 void setClippingArea(unsigned char x, unsigned char y, unsigned char width, unsigned char height); 00021 00022 public: 00023 DisplayN18(); 00024 00025 static const unsigned short BLUE = 0x00F8; 00026 static const unsigned short GREEN = 0xE007; 00027 static const unsigned short RED = 0x1F00; 00028 static const unsigned short WHITE = 0xFFFF; 00029 static const unsigned short BLACK = 0x0000; 00030 00031 static const unsigned int WIDTH = 160; 00032 static const unsigned int HEIGHT = 128; 00033 static const unsigned char CHAR_WIDTH = 5; 00034 static const unsigned char CHAR_HEIGHT = 8; 00035 static const unsigned char CHAR_SPACING = 1; 00036 00037 static unsigned short rgbToShort(unsigned char r, unsigned char g, unsigned char b); 00038 00039 void clear(unsigned short backColor = 0x0000); 00040 void draw(const unsigned short* data, int x, int y, int width, int height); 00041 void setPixel(int x, int y, unsigned short foreColor); 00042 00043 void fillRect(int x, int y, int width, int height, unsigned short foreColor); 00044 void drawRect(int x, int y, int width, int height, unsigned short foreColor); 00045 00046 void fillCircle(int x, int y, int radius, unsigned short foreColor); 00047 void drawCircle(int x, int y, int radius, unsigned short foreColor); 00048 00049 void drawLine(int x0, int y0, int x1, int y1, unsigned short foreColor); 00050 00051 void drawCharacter(int x, int y, const char character, unsigned short foreColor, unsigned short backColor, unsigned char fontSize = 1); 00052 void drawString(int x, int y, const char* str, unsigned short foreColor, unsigned short backColor, unsigned char fontSize = 1); 00053 };
Generated on Sun Jul 17 2022 01:40:40 by 1.7.2