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
Revision 30:41a872ad6155, committed 2011-01-08
- Comitter:
- Nakor
- Date:
- Sat Jan 08 09:06:11 2011 +0000
- Parent:
- 29:757036aa73cd
- Child:
- 31:7ad5bf258a1e
- Commit message:
- Added a function to load 16 bit images from a uSD.
Changed in this revision
uOLED.cpp | Show annotated file Show diff for this revision Revisions of this file |
uOLED.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/uOLED.cpp Tue Dec 28 21:24:03 2010 +0000 +++ b/uOLED.cpp Sat Jan 08 09:06:11 2011 +0000 @@ -2,10 +2,11 @@ #include "mbed.h" -#define OLED_INITDELAYMS 500 +#define OLED_INITDELAYMS 1200 #define OLED_ACK 0x06 // Ok #define OLED_NAK 0x15 // Error +//uOLED *pSGC; @@ -14,6 +15,8 @@ _reset(reset) { _oled.baud(230400); + + //friend class uOLED_watch; } /******************/ @@ -27,6 +30,8 @@ } + + /******************/ /* Public */ /******************/ @@ -126,6 +131,23 @@ return (_oled.getc() == OLED_ACK); } +bool uOLED::drawImageSD_16bit(char x, char y, char width, char height, char colourMode, char sectorHi, char sectorMid, char sectorLow) +{ + + _oled.putc(0x40); + _oled.putc(0x49); + _oled.putc(x); + _oled.putc(y); + _oled.putc(width); + _oled.putc(height); + _oled.putc(colourMode); + _oled.putc(sectorHi); + _oled.putc(sectorMid); + _oled.putc(sectorLow); + + return (_oled.getc() == OLED_ACK); +} + bool uOLED::drawLine(char x1, char y1, char x2, char y2, short red, short green, short blue) { short color = getRGB(red, green, blue);
--- a/uOLED.h Tue Dec 28 21:24:03 2010 +0000 +++ b/uOLED.h Sat Jan 08 09:06:11 2011 +0000 @@ -25,6 +25,7 @@ #define OLED_DISPLAYCONTROL_CONTRAST 0x02 #define OLED_DISPLAYCONTROL_POWER 0x03 + /** uOLED control class using Serial * * The serially controlled uOLEDs by 4D Systems are controlled @@ -220,6 +221,22 @@ */ bool drawImage(char x, char y, char width, char height, char colorMode, char *pixels); + /** Load an image from the uSD and display on the screen at specified location and size. + * + * @param x Image horizontal start position (top left). + * @param y Image vertical start position (top left). + * @param width Horizontal size of the image. + * @param height Vertical size of the image. + * @param colorMode Colour mode to use for the image. + * - 0x08 = 256 colour mode (8bits/1byte per pixel) + * - 0x10 = 65K colour mode (16bits/2bytes per pixel) + * @param sectorHi High sector address. + * @param sectorMid Mid sector address. + * @param sectorLow Low sector address. + */ + bool drawImageSD_16bit(char x, char y, char width, char height, char colourMode, char sectorHi, char sectorMid, char sectorLow); + + /** Draw a line. * * @param x1 Top left horizontal start position.