This library provides an OLED (SSD1332, 96x64xRGB) interface that best utilizes SSD1332's graphic accelerator (especially for drawing lines and rectangles). Though it still has some limitations --- it does not support 'clipping', odd numbers for circle/ellipse diameter, and so on, it runs quite fast. Enjoy the speed.

Dependents:   OLEDexample

Fork of OLEDaccel by Hideki Kozima

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers OLEDaccel.h Source File

OLEDaccel.h

00001 //
00002 //  OLEDaccel: 96x64 OLED driver
00003 //  (version 0.2, August 15, 2012)
00004 //  xkozima@myu.ac.jp
00005 
00006 #pragma once
00007 #include "mbed.h"
00008 
00009 class OLED {
00010 public:
00011     OLED(PinName rstPin, PinName csPin, PinName dcPin, PinName mosiPin, PinName sckPin);
00012     void clear(unsigned short color);
00013     void point(int x, int y, unsigned short color);
00014     void line(int x1, int y1, int x2, int y2, unsigned short color);
00015     void rect(int x, int y, int w, int h, unsigned short color, int fill);
00016     void circle(int x, int y, int r, unsigned short color, int fill);
00017     void ellipse(int x, int y, int rx, int ry, unsigned short color, int fill);
00018     void image(int x, int y, int w, int h, unsigned short *image16);
00019     void image(int x, int y, int w, int h, const unsigned short *image16);
00020     void image(int x, int y, int w, int h, unsigned char *image8x3);
00021     void image(int x, int y, int w, int h, const unsigned char *image8x3);
00022     void text(int x, int y, char *string, unsigned short color);
00023     void text(int x, int y, char *string, unsigned short colorF, unsigned short colorB);
00024     unsigned short color(int r, int g, int b);
00025 private:
00026     void cmdOutOne(unsigned char cmdOne);
00027     void cmdOut(unsigned char *cmd, int length);
00028     void dataOut(unsigned short *data, int length);
00029     DigitalOut rst, cs, dc;
00030     SPI spi;
00031     bool reversal;
00032     bool filling;
00033 };