Heavily documented control library for the uOLED-96-G1 (SGC) by 4D Systems. Will likely work with any of the 4D Systems serial controlled screens. <<info>> All examples in the documentation have been tested to the best of my current abilities, but there are a few functions that I simply do not use. I have created a Lighthouse page for this library. You may submit bug reports or feature requests to [[http://mbed-uoled.lighthouseapp.com|this page]]. If you really do not wish to sign up for a Lighthouse account you may also post any bugs or requests [[/users/Nakor/notebook/uoled-bug-reports/|here]]. <</info>>
Dependents: DS18B20 DS18B20GSM Astromed Astromed_build20121123
uOLED.h@0:4f009971ac11, 2010-12-20 (annotated)
- Committer:
- Nakor
- Date:
- Mon Dec 20 18:11:30 2010 +0000
- Revision:
- 0:4f009971ac11
- Child:
- 1:476dcc382de3
Library rewrite.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nakor | 0:4f009971ac11 | 1 | /* mbed 4D uOLED Library |
Nakor | 0:4f009971ac11 | 2 | * Originally designed for use with uOLED-96-G1 (SGC) |
Nakor | 0:4f009971ac11 | 3 | * serially controlled .96" screen. |
Nakor | 0:4f009971ac11 | 4 | * |
Nakor | 0:4f009971ac11 | 5 | * This is a modified library originally obtained from |
Nakor | 0:4f009971ac11 | 6 | * Erik van Wijk's library code at: |
Nakor | 0:4f009971ac11 | 7 | * http://mbed.org/users/evwijk/libraries/microOLED/li4nzn |
Nakor | 0:4f009971ac11 | 8 | */ |
Nakor | 0:4f009971ac11 | 9 | |
Nakor | 0:4f009971ac11 | 10 | #ifndef _MBED_UOLED_ |
Nakor | 0:4f009971ac11 | 11 | #define _MBED_UOLED_ |
Nakor | 0:4f009971ac11 | 12 | |
Nakor | 0:4f009971ac11 | 13 | #include "mbed.h" |
Nakor | 0:4f009971ac11 | 14 | |
Nakor | 0:4f009971ac11 | 15 | #define OLED_FONT5X7 0x01 |
Nakor | 0:4f009971ac11 | 16 | #define OLED_FONT8X8 0x02 |
Nakor | 0:4f009971ac11 | 17 | #define OLED_FONT8X12 0x03 |
Nakor | 0:4f009971ac11 | 18 | |
Nakor | 0:4f009971ac11 | 19 | #define OLED_DISPLAYCONTROL_DISPLAY 0x01 |
Nakor | 0:4f009971ac11 | 20 | #define OLED_DISPLAYCONTROL_CONTRAST 0x02 |
Nakor | 0:4f009971ac11 | 21 | #define OLED_DISPLAYCONTROL_POWER 0x03 |
Nakor | 0:4f009971ac11 | 22 | |
Nakor | 0:4f009971ac11 | 23 | /** uOLED control class using Serial |
Nakor | 0:4f009971ac11 | 24 | * |
Nakor | 0:4f009971ac11 | 25 | * Example: |
Nakor | 0:4f009971ac11 | 26 | * @code |
Nakor | 0:4f009971ac11 | 27 | * // Draw text on the screen. |
Nakor | 0:4f009971ac11 | 28 | * #include "mbed.h" |
Nakor | 0:4f009971ac11 | 29 | * #include "uOLED.h" |
Nakor | 0:4f009971ac11 | 30 | * |
Nakor | 0:4f009971ac11 | 31 | * uOLED SGC(p9, p10, p11); |
Nakor | 0:4f009971ac11 | 32 | * |
Nakor | 0:4f009971ac11 | 33 | int main() |
Nakor | 0:4f009971ac11 | 34 | * { |
Nakor | 0:4f009971ac11 | 35 | * SGC.drawText(0, 0, 0, FF, "This is text"); |
Nakor | 0:4f009971ac11 | 36 | * } |
Nakor | 0:4f009971ac11 | 37 | */ |
Nakor | 0:4f009971ac11 | 38 | class uOLED { |
Nakor | 0:4f009971ac11 | 39 | public: |
Nakor | 0:4f009971ac11 | 40 | |
Nakor | 0:4f009971ac11 | 41 | uOLED(PinName serialTX, PinName serialRX, PinName reset); |
Nakor | 0:4f009971ac11 | 42 | |
Nakor | 0:4f009971ac11 | 43 | short getRGB(char red, char green, char blue); |
Nakor | 0:4f009971ac11 | 44 | |
Nakor | 0:4f009971ac11 | 45 | bool addBitmappedCharacter(char character, char data[8]); |
Nakor | 0:4f009971ac11 | 46 | bool blockCopyPaste(char sourceX, char sourceY, char destinationX, char destinationY, char width, char height); |
Nakor | 0:4f009971ac11 | 47 | bool displayControl(char mode); |
Nakor | 0:4f009971ac11 | 48 | bool displayUserBitmappedCharacter(char character, char x, char y, short color); |
Nakor | 0:4f009971ac11 | 49 | bool drawCircle(char x, char y, char radius, short color); |
Nakor | 0:4f009971ac11 | 50 | bool drawCharacter(char character, char column, char row, short color); |
Nakor | 0:4f009971ac11 | 51 | bool drawImage(char x, char y, char width, char height, char colorMode, char *pixels); |
Nakor | 0:4f009971ac11 | 52 | bool drawLine(char x1, char y1, char x2, char y2, short color); |
Nakor | 0:4f009971ac11 | 53 | bool drawPolygon(char vertices, char *x, char *y, short color); |
Nakor | 0:4f009971ac11 | 54 | bool drawRectangle(char x, char y, char width, char height, short color); |
Nakor | 0:4f009971ac11 | 55 | bool drawText(char column, char row, char font, short color, char *text); |
Nakor | 0:4f009971ac11 | 56 | bool drawTriangle(char x1, char y1, char x2, char y2, char x3, char y3, short color); |
Nakor | 0:4f009971ac11 | 57 | bool eraseScreen(); |
Nakor | 0:4f009971ac11 | 58 | /** Initialize the screen. This must be completed before any other communication with the device. |
Nakor | 0:4f009971ac11 | 59 | * Timing allows for at least 500ms delay for initialization. |
Nakor | 0:4f009971ac11 | 60 | */ |
Nakor | 0:4f009971ac11 | 61 | bool init(); |
Nakor | 0:4f009971ac11 | 62 | bool penSize(char size); |
Nakor | 0:4f009971ac11 | 63 | bool putPixel(char x, char y, short color); |
Nakor | 0:4f009971ac11 | 64 | short readPixel(char x, char y); |
Nakor | 0:4f009971ac11 | 65 | bool setBackgroundColor(short color); |
Nakor | 0:4f009971ac11 | 66 | bool setFontSize(char fontType); |
Nakor | 0:4f009971ac11 | 67 | bool textButton(char state, char x, char y, short buttonColor, char font, short textColor, char textWidth, char textHeight, char *text); |
Nakor | 0:4f009971ac11 | 68 | bool textMode(char mode); |
Nakor | 0:4f009971ac11 | 69 | bool versionInfo(bool onScreen, char *info); |
Nakor | 0:4f009971ac11 | 70 | |
Nakor | 0:4f009971ac11 | 71 | |
Nakor | 0:4f009971ac11 | 72 | protected: |
Nakor | 0:4f009971ac11 | 73 | Serial _oled; |
Nakor | 0:4f009971ac11 | 74 | DigitalOut _reset; |
Nakor | 0:4f009971ac11 | 75 | |
Nakor | 0:4f009971ac11 | 76 | void resetDisplay(); |
Nakor | 0:4f009971ac11 | 77 | }; |