17 #ifndef OLEDC_H // Prevents duplicate 18 #define OLEDC_H // declarations 20 #if defined(__cplusplus) // If compiling for C++ 25 #include <propeller.h> 29 #define MAGENTA 0xF319 31 #define DARKRED 0xA162 32 #define REDORANGE 0xD261 33 #define LIGHTORANGE 0xFEB6 35 #define YELLOWORANGE 0xFCC0 39 #define YELLOWGREEN 0x5600 41 #define DARKGREEN 0x03CE 42 #define GREENBLUE 0x0C75 44 #define LIGHTBLUE 0x857B 45 #define SKYBLUE 0x0E3E 47 #define NAVYBLUE 0x0007 50 #define RASPBERRY 0xA82E 52 #define LIGHTBROWN 0xBB44 55 #define DARKBROWN 0x7269 56 #define LIGHTGRAY 0xBDD7 58 #define DARKGRAY 0x3186 85 void oledc_init(
char CS,
char RS,
char SID,
char SCLK,
char RST,
char screen_rotation);
133 void oledc_drawLine(
int x0,
int y0,
int x1,
int y1,
unsigned int color);
200 void oledc_drawRect(
int x,
int y,
int w,
int h,
unsigned int color);
215 void oledc_fillRect(
int x,
int y,
int w,
int h,
unsigned int color);
268 void oledc_drawTriangle(
int x0,
int y0,
int x1,
int y1,
int x2,
int y2,
unsigned int color);
287 void oledc_fillTriangle(
int x0,
int y0,
int x1,
int y1,
int x2,
int y2,
unsigned int color);
392 void oledc_copy(
int x0,
int y0,
int w,
int h,
int x2,
int y2);
450 #ifndef DOXYGEN_SHOULD_SKIP_THIS 461 #define gfx_swap(a, b) { unsigned int t = a; a = b; b = t; } 462 #define absv(x) ((x)<0 ? -(x) : (x)) 465 #define SSD1331_DELAYS_HWFILL 25 466 #define SSD1331_DELAYS_HWLINE 10 467 #define SSD1331_DELAYS_HWPIXEL 10 470 #define SSD1331_CMD_DRAWLINE 0x21 471 #define SSD1331_CMD_DRAWRECT 0x22 472 #define SSD1331_CMD_COPY 0x23 473 #define SSD1331_CMD_CLEAR 0x25 474 #define SSD1331_CMD_FILL 0x26 475 #define SSD1331_CMD_SCROLLSETUP 0x27 476 #define SSD1331_CMD_SCROLLSTOP 0x2E 477 #define SSD1331_CMD_SCROLLSTART 0x2F 478 #define SSD1331_CMD_SETCOLUMN 0x15 479 #define SSD1331_CMD_SETROW 0x75 480 #define SSD1331_CMD_CONTRASTA 0x81 481 #define SSD1331_CMD_CONTRASTB 0x82 482 #define SSD1331_CMD_CONTRASTC 0x83 483 #define SSD1331_CMD_MASTERCURRENT 0x87 484 #define SSD1331_CMD_SETREMAP 0xA0 485 #define SSD1331_CMD_STARTLINE 0xA1 486 #define SSD1331_CMD_DISPLAYOFFSET 0xA2 487 #define SSD1331_CMD_NORMALDISPLAY 0xA4 488 #define SSD1331_CMD_DISPLAYALLON 0xA5 489 #define SSD1331_CMD_DISPLAYALLOFF 0xA6 490 #define SSD1331_CMD_INVERTDISPLAY 0xA7 491 #define SSD1331_CMD_SETMULTIPLEX 0xA8 492 #define SSD1331_CMD_SETMASTER 0xAD 493 #define SSD1331_CMD_DISPLAYOFF 0xAE 494 #define SSD1331_CMD_DISPLAYON 0xAF 495 #define SSD1331_CMD_POWERMODE 0xB0 496 #define SSD1331_CMD_PRECHARGE 0xB1 497 #define SSD1331_CMD_CLOCKDIV 0xB3 498 #define SSD1331_CMD_PRECHARGEA 0x8A 499 #define SSD1331_CMD_PRECHARGEB 0x8B 500 #define SSD1331_CMD_PRECHARGEC 0x8C 501 #define SSD1331_CMD_PRECHARGELEVEL 0xBB 502 #define SSD1331_CMD_VCOMH 0xBE 546 void oledc_drawCharSmall(
int x,
int y,
unsigned char c,
unsigned int color,
unsigned int bg);
578 void oledc_drawCharLarge(
int x,
int y,
unsigned char c,
unsigned int color,
unsigned int bg);
602 #endif // DOXYGEN_SHOULD_SKIP_THIS 605 #if defined(__cplusplus) 610 #endif // End prevent duplicate forward void oledc_setCursor(int x, int y, char size)
Sets the cursor position based on the size parameter.
Definition: oledc_setCursor.c:22
void oledc_drawCharSmall(int x, int y, unsigned char c, unsigned int color, unsigned int bg)
Low-level driver for printing single characters to the screen in the small (5x7) font.
Definition: oledc_drawCharSmall.c:118
char font_lg_index[95]
Definition: oledc_drawCharLarge.c:20
void oledc_scrollStart(char h, char v)
Starts scrolling the entire image on the screen horizontally, vertically, or both.
Definition: oledc_scrollStart.c:24
int oledc_getHeight()
Returns the height of the screen per the screen's current orientation.
Definition: oledc_getScreenInfo.c:32
void oledc_setTextWrap(char w)
Toggles automatic wrapping of text printed to the screen. (0) turns wrapping off, (1) turning wrappin...
Definition: oledc_setText.c:46
void oledc_clear(int x0, int y0, int w, int h)
Clears (sets to black) a rectangular area of the screen.
Definition: oledc_clear.c:22
void oledc_fillCircle(int x0, int y0, int r, unsigned int color)
Draws a filled circle on the screen in the specified color.
Definition: oledc_fillCircle.c:20
char oled_font_lg[3100]
Definition: oledc_drawCharLarge.c:21
void oledc_writeData(char d)
Sets up the screen to recieve pixel data.
Definition: oledc_spiWrite.c:55
void oledc_spiWrite(char c)
Low-level driver for sending a byte to the OLED screen.
void oledc_init(char CS, char RS, char SID, char SCLK, char RST, char screen_rotation)
Initializes the OLED screen by setting up it's SPI and control pins.
Definition: oledc_init.c:34
void oledc_fillCircleHelper(int x0, int y0, int r, char cornername, int delta, unsigned int color)
Helper function used to draw filled circles and rectangles with rounded corners.
Definition: oledc_fillCircleHelper.c:21
int oledc_print(const char *fmt,...)
Print format "..." args to the screen. The output is limited to 128 bytes.
Definition: oledc_print.c:21
void oledc_bitmap(char *imgdir, int x0, int y0)
Displays a properly formatted bitmap (.BMP) image on the screen. The image must be saved as a Device ...
Definition: oledc_bitmap.c:26
void oledc_drawCharMedium(int x, int y, unsigned char c, unsigned int color, unsigned int bg)
Low-level driver for printing single characters to the screen in the medium (11x15) font...
Definition: oledc_drawCharMedium.c:22
char font_lg_zeroMap[658]
Definition: oledc_drawCharLarge.c:19
void oledc_goTo(int x, int y)
Low-level function for setting the pixel to be changed.
Definition: oledc_goTo.c:20
void oledc_fillRect(int x, int y, int w, int h, unsigned int color)
Draws a filled rectangle on the screen in the specified color.
Definition: oledc_fillRect.c:23
int oledc_isScrolling()
Returns (1) if the screen is currently scrolling and (0) if it is not.
Definition: oledc_getScreenInfo.c:36
void oledc_drawFastHLine(int x, int y, int w, unsigned int color)
Draws a horizontal line on the screen in the specified color.
Definition: oledc_drawFastLines.c:26
void oledc_drawCircle(int x0, int y0, int r, unsigned int color)
Draws a circle on the screen in the specified color.
Definition: oledc_drawCircle.c:21
void oledc_scrollStop()
Stops scrolling the screen.
Definition: oledc_scrollStop.c:22
int oledc_getWidth()
Returns the width of the screen per the screen's current orientation.
Definition: oledc_getScreenInfo.c:28
void oledc_setTextColor(unsigned int c, unsigned int b)
Sets the color of the font and the color of the background (highlighting) to be used. Setting the text color and text background to the same color will make the background color transparent.
Definition: oledc_setText.c:41
void oledc_drawTriangle(int x0, int y0, int x1, int y1, int x2, int y2, unsigned int color)
Draws a triangle with on the screen in the specified color.
Definition: oledc_drawTriangle.c:21
void oledc_write(char c)
Prints single ASCII-encoded characters to the screen. Characters 32 (space) to 126 (~) are rendered...
Definition: oledc_write.c:25
void oledc_setTextSize(char s)
Sets the size of the font to be used. Range is from 1 to 3. Size (1) is 5x7 (6x8 spacing) pixels...
Definition: oledc_setText.c:24
void oledc_invertDisplay()
Inverts the screen.
Definition: oledc_invertDisplay.c:22
int oledc_getCursorX()
Returns the current horizontal position of the cursor, measured from the left side of the screen in p...
Definition: oledc_getCursor.c:22
void oledc_drawLine(int x0, int y0, int x1, int y1, unsigned int color)
Draws a line on the screen in the specified color.
Definition: oledc_drawLine.c:24
void oledc_drawPixel(int x, int y, unsigned int color)
Draws a single pixel on the screen in the specified color.
Definition: oledc_drawPixel.c:23
void oledc_writeCommand(char c)
Sets up the screen to recieve commands.
Definition: oledc_spiWrite.c:50
void oledc_drawCharLarge(int x, int y, unsigned char c, unsigned int color, unsigned int bg)
Low-level driver for printing single characters to the screen in the large (17x23) font...
Definition: oledc_drawCharLarge.c:27
void oledc_setRotation(char x)
Low-level function used by the begin function to set up the screen's orientation. ...
Definition: oledc_setRotation.c:24
void oledc_copy(int x0, int y0, int w, int h, int x2, int y2)
Creates a copy a rectangular area of the screen at another position on the screen.
Definition: oledc_copy.c:21
void oledc_fillRoundRect(int x, int y, int w, int h, int r, unsigned int color)
Draws a filled rectangle with rounded corners on the screen in the specified color.
Definition: oledc_fillRoundRect.c:21
int oledc_getCursorY()
Returns the current vertical position of the cursor, measured from the top of the screen in pixels...
Definition: oledc_getCursor.c:26
void oledc_drawRect(int x, int y, int w, int h, unsigned int color)
Draws a rectangle on the screen in the specified color.
Definition: oledc_drawRect.c:23
void oledc_fillTriangle(int x0, int y0, int x1, int y1, int x2, int y2, unsigned int color)
Draws a filled triangle with on the screen in the specified color.
Definition: oledc_fillTriangle.c:21
void oledc_drawRoundRect(int x, int y, int w, int h, int r, unsigned int color)
Draws a rectangle with rounded corners on the screen in the specified color.
Definition: oledc_drawRoundRect.c:21
void oledc_drawCircleHelper(int x0, int y0, int r, char cornername, unsigned int color)
Helper function used to draw circles and rectangles with rounded corners.
Definition: oledc_drawCircleHelper.c:20
unsigned int oledc_color565(char r, char g, char b)
Generates a 2-byte (16-bit) color code (RRRRRGGGGGGBBBBB format) for use with the OLED screen...
Definition: oledc_color565.c:19
void oledc_drawFastVLine(int x, int y, int h, unsigned int color)
Draws a vertical line on the screen in the specified color.
Definition: oledc_drawFastLines.c:20
char oledc_getRotation()
Returns the screen's orientation. (0) means the pins are pointed upwards, (1) means the pins are poin...
Definition: oledc_getScreenInfo.c:24