SSD1331 Oled driver library for 96x64 colour Oled display. Demo included in .h file
Dependents: Oled-SSD1331 PJ12_device
Diff: ssd1331.h
- Revision:
- 2:1204274fad8f
- Parent:
- 1:f3f6624f45d4
- Child:
- 3:a4caac512e13
--- a/ssd1331.h Sun May 01 12:37:44 2016 +0000 +++ b/ssd1331.h Fri May 06 21:40:50 2016 +0000 @@ -36,6 +36,27 @@ #define SCROLL_STOP 0x2E // Scroll Stop #define SCROLL_START 0x2F // Scroll Start +// some RGB color definitions RED GREEN BLUE + +#define Black 0x0000 // 0, 0, 0 +#define Navy 0x8000 // 0, 0, 128 +#define DarkGreen 0x0400 // 0, 128, 0 +#define DarkCyan 0x8400 // 0, 128, 128 +#define Maroon 0x0010 // 128, 0, 0 +#define Purple 0x8010 // 128, 0, 128 +#define Olive 0x0410 // 128, 128, 0 +#define LightGrey 0xC618 // 192, 192, 192 +#define DarkGrey 0x7BEF // 128, 128, 128 +#define Red 0xF800 // 255, 0, 0 +#define Green 0x07E0 // 0, 255, 0 +#define Yellow 0x07FF // 255, 255, 0 +#define Blue 0x001F // 0, 0, 255 +#define Magenta 0xF81F // 255, 0, 255 +#define Cyan 0xFFE0 // 0, 255, 255 +#define White 0xFFFF // 255, 255, 255 +#define Orange 0x053F // 255, 165, 0 +#define GreenYellow 0x2FF5 // 173, 255, 47 + // example code /* #include "mbed.h" @@ -138,8 +159,8 @@ ssd1331(PinName cs_pin, PinName rst_pin, PinName a0_pin, PinName mosi_pin, PinName miso_pin, PinName sclk_pin); void pixel(int x,int y,unsigned int color); - void rectangle(int x1,int y1,int x2,int y2,unsigned int colorline); - void fillrectangle(int x1,int y1,int x2,int y2,unsigned int colorline,unsigned int colorfill); + void rect(int x1,int y1,int x2,int y2,unsigned int colorline); + void fillrect(int x1,int y1,int x2,int y2,unsigned int colorline,unsigned int colorfill); void line( int x1,int y1,int x2,int y2,unsigned int color); void circle (int radius, int x, int y,unsigned int color,int fill); void Fill_Screen(unsigned int color); // fill screen with any colour @@ -161,10 +182,9 @@ void Copy(int src_x1,int src_y1,int src_x2,int src_y2, int dst_x,int dst_y); void character(int x, int y, int c); void set_font(unsigned char* f); - void drawBitmap(const uint8_t *bitmap, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); - int BMP_16(const char *Name_BMP, unsigned int x, unsigned int y); - - int DrawBitmapFile(const char *Name_BMP); + void Bitmap(const uint8_t *bitmap, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); + void Bitmap16(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap); + int Bitmap16SD( unsigned int x, unsigned int y, unsigned char *Name_BMP); // 12.288k protected: @@ -185,6 +205,7 @@ unsigned int Char_Color; // text color unsigned int BGround_Color; // background color void window(int x, int y, int w, int h); + void Maxwindow(); // reset display window to full size // pixel location short _x; short _y; @@ -202,6 +223,7 @@ int externalfont; DigitalOut CS, RES, DC; SPI spi; // mosi, miso, sclk + }; #endif