Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
Adafruit_SSD1306 Class Reference

Class that stores state and functions for interacting with SSD1306 OLED displays. More...

#include <Adafruit_SSD1306.hpp>

Inheritance diagram for Adafruit_SSD1306:
Adafruit_GFX Print

Public Member Functions

 Adafruit_SSD1306 (uint8_t w, uint8_t h, TwoWire *twi, int8_t rst_pin=-1, uint32_t clkDuring=400000UL, uint32_t clkAfter=100000UL)
 Bind an SSD1306 display without allocating its framebuffer. Width/height are pixels; constructors select I2C, software SPI, or hardware SPI. Bus pointers are borrowed. Reset pin -1 omits GPIO reset; I2C clocks and SPI bitrate are in hertz. Call begin() before drawing, then display() to send changes. Legacy constructors without dimensions are declared but not implemented in this port.
 Adafruit_SSD1306 (uint8_t w, uint8_t h, int8_t mosi_pin, int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin, int8_t cs_pin)
 Bind an SSD1306 display without allocating its framebuffer. Width/height are pixels; constructors select I2C, software SPI, or hardware SPI. Bus pointers are borrowed. Reset pin -1 omits GPIO reset; I2C clocks and SPI bitrate are in hertz. Call begin() before drawing, then display() to send changes. Legacy constructors without dimensions are declared but not implemented in this port.
 Adafruit_SSD1306 (uint8_t w, uint8_t h, SPIClass *spi, int8_t dc_pin, int8_t rst_pin, int8_t cs_pin, uint32_t bitrate=8000000UL)
 Bind an SSD1306 display without allocating its framebuffer. Width/height are pixels; constructors select I2C, software SPI, or hardware SPI. Bus pointers are borrowed. Reset pin -1 omits GPIO reset; I2C clocks and SPI bitrate are in hertz. Call begin() before drawing, then display() to send changes. Legacy constructors without dimensions are declared but not implemented in this port.
 Adafruit_SSD1306 (int8_t mosi_pin, int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin, int8_t cs_pin)
 Bind an SSD1306 display without allocating its framebuffer. Width/height are pixels; constructors select I2C, software SPI, or hardware SPI. Bus pointers are borrowed. Reset pin -1 omits GPIO reset; I2C clocks and SPI bitrate are in hertz. Call begin() before drawing, then display() to send changes. Legacy constructors without dimensions are declared but not implemented in this port.
 Adafruit_SSD1306 (int8_t dc_pin, int8_t rst_pin, int8_t cs_pin)
 Bind an SSD1306 display without allocating its framebuffer. Width/height are pixels; constructors select I2C, software SPI, or hardware SPI. Bus pointers are borrowed. Reset pin -1 omits GPIO reset; I2C clocks and SPI bitrate are in hertz. Call begin() before drawing, then display() to send changes. Legacy constructors without dimensions are declared but not implemented in this port.
 Adafruit_SSD1306 (int8_t rst_pin=-1)
 Bind an SSD1306 display without allocating its framebuffer. Width/height are pixels; constructors select I2C, software SPI, or hardware SPI. Bus pointers are borrowed. Reset pin -1 omits GPIO reset; I2C clocks and SPI bitrate are in hertz. Call begin() before drawing, then display() to send changes. Legacy constructors without dimensions are declared but not implemented in this port.
 ~Adafruit_SSD1306 (void)
 Release the owned framebuffer.
boolean begin (uint8_t switchvcc=SSD1306_SWITCHCAPVCC, uint8_t i2caddr=0, boolean reset=true, boolean periphBegin=true)
 Allocate the framebuffer and initialize the controller.
virtual void display (void)
 Transmit the complete framebuffer to the panel synchronously.
void clearDisplay (void)
 Clear the framebuffer without transmitting it.
void invertDisplay (boolean i)
 Set hardware inversion when i is true without modifying the framebuffer.
void dim (boolean dim)
 Use the dimmed contrast setting when dim is true.
void drawPixel (int16_t x, int16_t y, uint16_t color)
 Draw a buffered pixel at x/y using SSD1306_BLACK, SSD1306_WHITE, or SSD1306_INVERSE.
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 Draw a clipped horizontal framebuffer line of w pixels using the current rotation.
virtual void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 Draw a clipped vertical framebuffer line of h pixels using the current rotation.
void startscrollright (uint8_t start, uint8_t stop)
 Start rightward hardware scrolling between inclusive page indices start and stop.
void startscrollleft (uint8_t start, uint8_t stop)
 Start leftward hardware scrolling between inclusive page indices start and stop.
void startscrolldiagright (uint8_t start, uint8_t stop)
 Start diagonal rightward scrolling over inclusive page indices start and stop.
void startscrolldiagleft (uint8_t start, uint8_t stop)
 Start diagonal leftward scrolling over inclusive page indices start and stop.
void stopscroll (void)
 Stop hardware scrolling.
void ssd1306_command (uint8_t c)
 Send one raw command byte to the controller.
boolean getPixel (int16_t x, int16_t y)
 Return the buffered pixel state at x/y; return false outside the rotated bounds.
uint8_t * getBuffer (void)
 Return the borrowed page-organized framebuffer; it is owned by this object.
Public Member Functions inherited from Adafruit_GFX
 Adafruit_GFX (int16_t w, int16_t h)
 Construct a graphics surface with native width w and height h in pixels. Coordinates use pixels from the upper-left corner; colors are interpreted by the concrete display. Subclasses must implement drawPixel().
virtual void writeFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 Write a vertical line of h pixels at x/y using color.
virtual void writeFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 Write a horizontal line of w pixels at x/y using color.
virtual void writeLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 Write a line between the inclusive endpoints (x0,y0) and (x1,y1).
virtual void setRotation (uint8_t r)
 Select orientation using the low two bits of r (0, 90, 180, or 270 degrees).
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 Draw a horizontal line of w pixels at x/y with the current display orientation.
virtual void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Fill a rectangle at x/y of width w and height h in pixels.
virtual void fillScreen (uint16_t color)
 Fill the entire graphics surface with color.
virtual void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 Draw a line between the inclusive endpoints (x0,y0) and (x1,y1).
virtual void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Draw the outline of a rectangle at x/y of width w and height h in pixels.
virtual size_t write (uint8_t)
 Render one character at the text cursor, honoring font, scale, wrapping, and colors.
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draw a circle outline centered at x0/y0 with radius r in pixels.
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
 Draw selected circle quadrants; cornername is the four-bit quadrant mask.
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Fill a circle centered at x0/y0 with radius r in pixels.
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
 Fill selected circle sides; cornername selects sides and delta extends vertical spans.
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Draw a triangle outline through the three supplied pixel-coordinate vertices.
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Fill a triangle through the three supplied pixel-coordinate vertices.
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 Draw a rectangle outline at x0/y0 with pixel dimensions w/h and corner radius.
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 Fill a rectangle at x0/y0 with pixel dimensions w/h and corner radius.
void drawBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
 Draw a row-padded, MSB-first 1-bit bitmap of w by h pixels at x/y. Set bits use color; clear bits are transparent unless the bg overload is used.
void drawBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color, uint16_t bg)
 Draw a row-padded, MSB-first 1-bit bitmap of w by h pixels at x/y. Set bits use color; clear bits are transparent unless the bg overload is used.
void drawBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 Draw a row-padded, MSB-first 1-bit bitmap of w by h pixels at x/y. Set bits use color; clear bits are transparent unless the bg overload is used.
void drawBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg)
 Draw a row-padded, MSB-first 1-bit bitmap of w by h pixels at x/y. Set bits use color; clear bits are transparent unless the bg overload is used.
void drawXBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
 Draw an LSB-first XBM image of w by h pixels; zero bits are transparent.
void drawGrayscaleBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h)
 Draw w by h bytes of grayscale pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawGrayscaleBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h)
 Draw w by h bytes of grayscale pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawGrayscaleBitmap (int16_t x, int16_t y, const uint8_t bitmap[], const uint8_t mask[], int16_t w, int16_t h)
 Draw w by h bytes of grayscale pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawGrayscaleBitmap (int16_t x, int16_t y, uint8_t *bitmap, uint8_t *mask, int16_t w, int16_t h)
 Draw w by h bytes of grayscale pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawRGBBitmap (int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h)
 Draw w by h RGB565 pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawRGBBitmap (int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h)
 Draw w by h RGB565 pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawRGBBitmap (int16_t x, int16_t y, const uint16_t bitmap[], const uint8_t mask[], int16_t w, int16_t h)
 Draw w by h RGB565 pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawRGBBitmap (int16_t x, int16_t y, uint16_t *bitmap, uint8_t *mask, int16_t w, int16_t h)
 Draw w by h RGB565 pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 Draw character c at x/y with foreground/background colors and integer pixel scale.
void setCursor (int16_t x, int16_t y)
 Set the text cursor in pixels; custom-font y coordinates refer to the baseline.
void setTextColor (uint16_t c)
 Set text foreground color; the two-argument overload also sets background. The one-argument overload uses transparent background for the classic font.
void setTextColor (uint16_t c, uint16_t bg)
 Set text foreground color; the two-argument overload also sets background. The one-argument overload uses transparent background for the classic font.
void setTextSize (uint8_t s)
 Set integer text magnification; zero is treated as one.
void setTextWrap (boolean w)
 Enable or disable automatic text wrapping at the right edge.
void cp437 (boolean x=true)
 Enable corrected CP437 character mapping; false retains the legacy mapping.
void setFont (const GFXfont *f=NULL)
 Select a borrowed GFXfont; nullptr restores the built-in fixed-width font.
int16_t height (void) const
 Return the surface height in pixels after rotation.
int16_t width (void) const
 Return the surface width in pixels after rotation.
uint8_t getRotation (void) const
 Return the current rotation index, 0 through 3.
int16_t getCursorX (void) const
 Return the text cursor X coordinate in pixels.
int16_t getCursorY (void) const
 Return the text cursor Y coordinate in pixels.
Public Member Functions inherited from Print
int getWriteError ()
void clearWriteError ()
size_t write (const char *str)
 문자열을 출력합니다.
virtual size_t write (const uint8_t *buffer, size_t size)
 데이터 배열을 출력합니다.
size_t write (const char *buffer, size_t size)
 데이터 배열을 출력합니다.
virtual int availableForWrite ()
size_t print (const __FlashStringHelper *)
 프로그램 메모리(읽기 전용 플래시) 영역에 저장된 문자열을 출력합니다.
size_t print (const std::string &)
 문자열을 출력합니다.
size_t print (const char[])
 NULL로 종료되는 문자열을 출력합니다.
size_t print (char)
 문자 하나를 출력합니다.
size_t print (unsigned char, int=DEC)
 부호가 없는(unsigned) 8-byte 정수를 지정한 진수 형태로 출력합니다.
size_t print (int, int=DEC)
 int 형 정수를 지정한 진수 형태로 출력합니다.
size_t print (unsigned int, int=DEC)
 unsigned int 형 정수를 지정한 진수 형태로 출력합니다.
size_t print (long, int=DEC)
 long 형 정수를 지정한 진수 형태로 출력합니다.
size_t print (unsigned long, int=DEC)
 unsigned long 형 정수를 지정한 진수 형태로 출력합니다.
size_t print (double, int=2)
 double 형 실수를 지정한 소수점 이하 출력 개수로 출력합니다.
size_t print (const Printable &)
 Printable을 구현한 클래스를 출력합니다.
size_t println (const __FlashStringHelper *)
 프로그램 메모리(읽기 전용 플래시) 영역에 저장된 문자열과 개행문자(CR+LF)를 출력합니다.
size_t println (const std::string &s)
 문자열과 개행문자(CR+LF)를 출력합니다.
size_t println (const char[])
 NULL로 종료되는 문자열과 개행문자(CR+LF)를 출력합니다.
size_t println (char)
 문자 하나와 개행문자(CR+LF)를 출력합니다.
size_t println (unsigned char, int=DEC)
 부호가 없는(unsigned) 8-byte 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (int, int=DEC)
 int 형 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (unsigned int, int=DEC)
 unsigned int 형 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (long, int=DEC)
 long 형 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (unsigned long, int=DEC)
 unsigned long 형 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (double, int=2)
 double 형 실수를 지정한 소수점 이하 출력 개수로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (const Printable &)
 Printable을 구현한 클래스를, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (void)
 개행문자(CR+LF)를 출력합니다.
virtual int printf (const char *,...)
 printf 출력을 내보냅니다.
virtual void flush ()

Additional Inherited Members

Protected Member Functions inherited from Adafruit_GFX
void charBounds (char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy)
Protected Member Functions inherited from Print
void setWriteError (int err=1)
Protected Attributes inherited from Adafruit_GFX
const int16_t WIDTH
const int16_t HEIGHT
int16_t _width
int16_t _height
int16_t cursor_x
int16_t cursor_y
uint16_t textcolor
uint16_t textbgcolor
uint8_t textsize
uint8_t rotation
boolean wrap
boolean _cp437
const GFXfont * gfxFont

Detailed Description

Member Function Documentation

◆ begin()

boolean Adafruit_SSD1306::begin ( uint8_t switchvcc = SSD1306_SWITCHCAPVCC,
uint8_t i2caddr = 0,
boolean reset = true,
boolean periphBegin = true )

Allocate the framebuffer and initialize the controller.

Parameters
switchvccSSD1306_SWITCHCAPVCC or SSD1306_EXTERNALVCC.
i2caddr7-bit address; zero selects the display-height-dependent default.
resetPulse the configured reset pin if available.
periphBeginWhether to initialize the selected peripheral.
Returns
False on framebuffer allocation failure, otherwise true; no I2C probe is performed.

◆ drawFastVLine()

virtual void Adafruit_SSD1306::drawFastVLine ( int16_t x,
int16_t y,
int16_t h,
uint16_t color )
virtual

Draw a clipped vertical framebuffer line of h pixels using the current rotation.

Reimplemented from Adafruit_GFX.

◆ drawPixel()

void Adafruit_SSD1306::drawPixel ( int16_t x,
int16_t y,
uint16_t color )
virtual

Draw a buffered pixel at x/y using SSD1306_BLACK, SSD1306_WHITE, or SSD1306_INVERSE.

Implements Adafruit_GFX.

◆ invertDisplay()

void Adafruit_SSD1306::invertDisplay ( boolean i)
virtual

Set hardware inversion when i is true without modifying the framebuffer.

Reimplemented from Adafruit_GFX.


The documentation for this class was generated from the following file: