Skip to content

Drawing

Tara K edited this page Apr 9, 2018 · 3 revisions

Colors:

  • SSD_COLOR_BLACK: The pixel will be turned off
  • SSD_COLOR_WHITE: The pixel will be turned on
  • SSD_COLOR_XOR: XOR Will be performed instead of setting a color

Note: These will appear inverted if you set the display to inverted with SSD1306_SetInverted

Drawing operations:

SSD1306_DrawPixel:

void IRAM_ATTR SSD1306_DrawPixel( struct SSD1306_Device* DeviceHandle, int x, int y, int Color )

Sets a pixel at (x,y) to (Color)

Parameters:

  1. Pointer to device handle
  2. X Coordinate
  3. Y Coordinate
  4. Colour to draw with

SSD1306_DrawHLine:

void IRAM_ATTR SSD1306_DrawHLine( struct SSD1306_Device* DeviceHandle, int x, int y, int Width, int Color )

Draws a horizontal line starting from (x,y) to (x + width,y) using the color (Color)

Parameters:

  1. Pointer to device handle
  2. Starting X coordinate
  3. Starting Y coordinate
  4. Width of line
  5. Color of line

SSD1306_DrawVLine:

void IRAM_ATTR SSD1306_DrawVLine( struct SSD1306_Device* DeviceHandle, int x, int y, int Height, int Color )

Draws a vertical line starting from (x,y) to (x,y + width) with the color (Color)

Parameters:

  1. Pointer to device handle
  2. Starting X coordinate
  3. Starting Y coordinate
  4. Height of line
  5. Color of line

SSD1306_DrawLine:

void IRAM_ATTR SSD1306_DrawLine( struct SSD1306_Device* DeviceHandle, int x0, int y0, int x1, int y1, int Color )

Draws a line starting from (x0,y0) to (x1,y1) with the color (Color)

Parameters:

  1. Pointer to device handle
  2. Starting X coordinate
  3. Starting Y coordinate
  4. Ending X coordinate
  5. Ending Y coordinate
  6. Color of line

SSD1306_DrawBox:

void IRAM_ATTR SSD1306_DrawBox( struct SSD1306_Device* DeviceHandle, int x1, int y1, int x2, int y2, int Color, bool Fill )

Draws a box starting from (x1,y1) to (x2,y2) with color (Color), optionally filling the box instead of just an outline

Parameters:

  1. Pointer to device handle
  2. Starting X coordinate
  3. Starting Y coordinate
  4. Ending X coordinate
  5. Ending Y coordinate
  6. Color of box
  7. If true the box will be filled with (Color)

SSD1306_Clear:

void SSD1306_Clear( struct SSD1306_Device* DeviceHandle, int Color )

Fills the local framebuffer with (Color)
Note: This does not send the framebuffer to the screen on it's own

Parameters:

  1. Pointer to device handle
  2. Color to fill local framebuffer with