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.
Fork of OLEDaccel by
OLEDaccel.h@0:76a5ae915f62, 2012-08-17 (annotated)
- Committer:
- xkozima
- Date:
- Fri Aug 17 15:30:29 2012 +0000
- Revision:
- 0:76a5ae915f62
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...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xkozima | 0:76a5ae915f62 | 1 | // |
xkozima | 0:76a5ae915f62 | 2 | // OLEDaccel: 96x64 OLED driver |
xkozima | 0:76a5ae915f62 | 3 | // (version 0.2, August 15, 2012) |
xkozima | 0:76a5ae915f62 | 4 | // xkozima@myu.ac.jp |
xkozima | 0:76a5ae915f62 | 5 | |
xkozima | 0:76a5ae915f62 | 6 | #pragma once |
xkozima | 0:76a5ae915f62 | 7 | #include "mbed.h" |
xkozima | 0:76a5ae915f62 | 8 | |
xkozima | 0:76a5ae915f62 | 9 | class OLED { |
xkozima | 0:76a5ae915f62 | 10 | public: |
xkozima | 0:76a5ae915f62 | 11 | OLED(PinName rstPin, PinName csPin, PinName dcPin, PinName mosiPin, PinName sckPin); |
xkozima | 0:76a5ae915f62 | 12 | void clear(unsigned short color); |
xkozima | 0:76a5ae915f62 | 13 | void point(int x, int y, unsigned short color); |
xkozima | 0:76a5ae915f62 | 14 | void line(int x1, int y1, int x2, int y2, unsigned short color); |
xkozima | 0:76a5ae915f62 | 15 | void rect(int x, int y, int w, int h, unsigned short color, int fill); |
xkozima | 0:76a5ae915f62 | 16 | void circle(int x, int y, int r, unsigned short color, int fill); |
xkozima | 0:76a5ae915f62 | 17 | void ellipse(int x, int y, int rx, int ry, unsigned short color, int fill); |
xkozima | 0:76a5ae915f62 | 18 | void image(int x, int y, int w, int h, unsigned short *image16); |
xkozima | 0:76a5ae915f62 | 19 | void image(int x, int y, int w, int h, const unsigned short *image16); |
xkozima | 0:76a5ae915f62 | 20 | void image(int x, int y, int w, int h, unsigned char *image8x3); |
xkozima | 0:76a5ae915f62 | 21 | void image(int x, int y, int w, int h, const unsigned char *image8x3); |
xkozima | 0:76a5ae915f62 | 22 | void text(int x, int y, char *string, unsigned short color); |
xkozima | 0:76a5ae915f62 | 23 | void text(int x, int y, char *string, unsigned short colorF, unsigned short colorB); |
xkozima | 0:76a5ae915f62 | 24 | unsigned short color(int r, int g, int b); |
xkozima | 0:76a5ae915f62 | 25 | private: |
xkozima | 0:76a5ae915f62 | 26 | void cmdOutOne(unsigned char cmdOne); |
xkozima | 0:76a5ae915f62 | 27 | void cmdOut(unsigned char *cmd, int length); |
xkozima | 0:76a5ae915f62 | 28 | void dataOut(unsigned short *data, int length); |
xkozima | 0:76a5ae915f62 | 29 | DigitalOut rst, cs, dc; |
xkozima | 0:76a5ae915f62 | 30 | SPI spi; |
xkozima | 0:76a5ae915f62 | 31 | bool reversal; |
xkozima | 0:76a5ae915f62 | 32 | bool filling; |
xkozima | 0:76a5ae915f62 | 33 | }; |