MicroView Hookup Guide
MicroView Class Reference
Below you will find a complete list of available MicroView classes that can be called in your code.
Initialization
void begin(void)
---Initialization of MicroView Library.Setup IO pins for SPI port then send initialization commands to the SSD1306 controller inside the OLED.void end (void)
---Power off the OLED display. Reset display control signals and prepare the SSD1306 controller for power off, then power off the 3.3V regulator.
Display Actions, Settings and Orientation
void display(void)
---Transfer display memory. Bulk move the screen buffer to the SSD1306 controller's memory so that images/graphics drawn on the screen buffer will be displayed on the OLED.void clear(* uint8_t mode)
---Clear screen buffer or SSD1306's memory. To clear GDRAM inside the LCD controller, pass in the variable mode = ALL and to clear screen page buffer pass in the variable mode = PAGE.void clear(* uint8_t mode, * uint8_t c)
---Clear or replace screen buffer or SSD1306's memory with a character. To clear GDRAM inside the LCD controller, pass in the variable mode = ALL with c character and to clear screen page buffer, pass in the variable mode = PAGE with c character.void invert(boolean inv)
---Invert display. The WHITE color of the display will turn to BLACK, and the BLACK will turn to WHITE.void contrast(* uint8_t contrast)
---Set contrast. OLED contrast value from 0 to 255. Note: Contrast level is not very obvious.void setCursor(* uint8_t x, * uint8_t y)
---Set cursor position. MicroView's cursor position to x,y.void flipVertical(boolean flip)
---Vertical flip. Flip the graphics on the OLED vertically.void flipHorizontal(boolean flip)
---Horizontal flip. Flip the graphics on the OLED horizontally.uint8_t getLCDWidth(void)
---The width of the LCD return as byte.uint8_t getLCDHeight(void)
---The height of the LCD return as byte.
Display Scrolling
void scrollRight(* uint8_t start, * uint8_t stop)
---Right scrolling. Set row start to row stop on the OLED to scroll right. Refer to OLED Memory Map section for explanation of the rows.void scrollLeft(* uint8_t start, * uint8_t stop)
---Left scrolling. Set row start to row stop on the OLED to scroll left. Refer to OLED Memory Map section for explanation of the rows.void scrollVertRight(* uint8_t start, * uint8_t stop)
---Right vertical scrolling. Set column start to row stop on the OLED to scroll right. Refer to OLED Memory Map section for explanation of the columns.void scrollVertLeft(* uint8_t start, * uint8_t stop)
---Left vertical scrolling. Set column start to row stop on the OLED to scroll left. Refer to OLED Memory Map section for explanation of the columns.void scrollStop(void)
---Stop the scrolling of graphics on the OLED.
Font Functions
uint8_t getFontWidth(void)
---Get font width. The current font's width return as byte.uint8_t getFontHeight(void)
---Get font height. The current font's height return as byte.uint8_t getTotalFonts(void)
---Get total fonts. Return the total number of fonts loaded into the MicroView's flash memory.uint8_t getFontType(void)
---Get font type. Return the font type number of the current font.uint8_t setFontType(* uint8_t type)
---Set font type. Set the current font type number (i.e., changing to different fonts based on the type provided).uint8_t getFontStartChar(void)
---Get font starting character. Return the starting ASCII character of the current font; not all fonts start with ASCII character 0. Custom fonts can start from any ASCII character.uint8_t getFontTotalChar(void)
---Get font total characters. Return the total characters of the current font.
Drawing Pixels
void pixel(* uint8_t x, * uint8_t y)
---Draw pixel. Draw pixel using the current fore color and current draw mode in the screen buffer's x,y position.void pixel(* uint8_t x, * uint8_t y, * uint8_t color, * uint8_t mode)
---Draw pixel with color and mode. Draw color pixel in the screen buffer's x,y position with NORM or XOR draw mode.
Drawing Lines
void line(* uint8_t x0, * uint8_t y0, * uint8_t x1, * uint8_t y1)
---Draw line using current fore color and current draw mode from x0,y0 to x1,y1 of the screen buffer.void line(* uint8_t x0, * uint8_t y0, * uint8_t x1, * uint8_t y1, * uint8_t color, * uint8_t mode)
---Draw line using color and mode from x0,y0 to x1,y1 of the screen buffer.void lineH(* uint8_t x, * uint8_t y, * uint8_t width)
---Draw horizontal line using current fore color and current draw mode from x,y to x+width,y of the screen buffer.void lineH(* uint8_t x, * uint8_t y, * uint8_t width, * uint8_t color, * uint8_t mode)
---Draw horizontal line using color and mode from x,y to x+width,y of the screen buffer.void lineV(* uint8_t x, * uint8_t y, * uint8_t height)
---Draw vertical line using current fore color and current draw mode from x,y to x,y+height of the screen buffer.void lineV(* uint8_t x, * uint8_t y, * uint8_t height, * uint8_t color, * uint8_t mode)
---Draw vertical line using color and mode from x,y to x,y+height of the screen buffer.
Drawing Rectangles
void rect(* uint8_t x, * uint8_t y, * uint8_t width, * uint8_t height)
---Draw rectangle using current fore color and current draw mode from x,y to x+width,y+height of the screen buffer.void rect(* uint8_t x, * uint8_t y, * uint8_t width, * uint8_t height, * uint8_t color, * uint8_t mode)
---Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer.void rectFill(* uint8_t x, * uint8_t y, * uint8_t width, * uint8_t height)
---Draw filled rectangle using current fore color and current draw mode from x,y to x+width,y+height of the screen buffer.void rectFill(* uint8_t x, * uint8_t y, * uint8_t width, * uint8_t height, * uint8_t color, * uint8_t mode)
---Draw filled rectangle using color and mode from x,y to x+width,y+height of the screen buffer.
Drawing Circles
void circle(* uint8_t x, * uint8_t y, * uint8_t radius)
---Draw circle with radius using current fore color and current draw mode at x,y of the screen buffer.void circle(* uint8_t x, * uint8_t y, * uint8_t radius, * uint8_t color, * uint8_t mode)
---Draw circle with radius using color and mode at x,y of the screen buffer.void circleFill(* uint8_t x0, * uint8_t y0, * uint8_t radius)
---Draw filled circle with radius using current fore color and current draw mode at x,y of the screen buffer.void circleFill(* uint8_t x0, * uint8_t y0, * uint8_t radius, * uint8_t color, * uint8_t mode)
---Draw filled circle with radius using color and mode at x,y of the screen buffer. Uses the Bresenham circle algorithm with a few modifications to paint the circle without overlapping draw operations.
MISC Drawing
void drawChar(* uint8_t x, * uint8_t y, * uint8_t c)
---Draw character c using current color and current draw mode at x,y.void drawChar(* uint8_t x, * uint8_t y, * uint8_t c, * uint8_t color, * uint8_t mode)
---Draw character c using color and draw mode at x,y.void drawBitmap(void)
---Draw bitmap image stored elsewhere in the program to the OLED screen.void setColor(* uint8_t color)
---Set the current draw's color. Only WHITE and BLACK available.void setDrawMode(* uint8_t mode)
---Set current draw mode with NORM or XOR.
MicroViewWidget
MicroViewWidget(uint8_t newx, uint8_t newy, int16_t min, int16_t max)
---MicroView widget parent class. The MicroViewWidget class is the parent class for child widget like MicroViewSlider and MicroViewGauge.uint8_t getX()
---Get widget x position.uint8_t getY()
---Get widget y position.void setX(uint8_t newx)
---Set widget x position.void setY(uint8_t newy)
---Set widget y position.int16_t getMinValue()
---Return the minimum value of the widget.int16_t getMaxValue()
---Return the maximum value of the widget.int16_t getValue()
---Return the current value of the widget.void setMinValue(int16_t min)
---Set minimum value. The minimum value of the widget is set to the variable passed in.void setMaxValue(int16_t max)
---Set maximum value. The maximum value of the widget is set to the variable passed in.void setValue(int16_t val)
---The current value of the widget is set to the variable passed in, and the widget is drawn with the new value.void setValue(int16_t val, boolean doDraw)
---The current value of the widget is set to the variable passed in. The widget is drawn with the new value if the doDraw argument is true.uint8_t getValLen()
---Return the number of characters that would be printed usinguView.print(value)
for the current value.uint8_t getMaxValLen()
---Return the maximum number of characters that would be printed using uView.print(value) for the current value range.virtual void draw()
---Draw widget value overridden by child class.virtual void drawFace()
---Draw widget face overridden by child class.void reDraw()
---MicroView Widget reDraw routine. Redraws the widget.void drawNumValue(int16_t value)
---Draw a signed decimal numeric value at the current cursor location. The value is right justified with leading spaces, within a field the length of the maximum possible for the widget's value range.
MicroViewGauge
MicroViewGauge(uint8_t newx, uint8_t newy, int16_t min, int16_t max)
---MicroViewGauge class initialization. Initialize the MicroViewGauge widget with default style.MicroViewGauge(uint8_t newx, uint8_t newy, int16_t min, int16_t max, uint8_t sty)
---Initialize the MicroViewGauge widget with style WIDGETSTYLE0 or WIDGETSTYLE1. Add WIDGETNOVALUE to the style to suppress displaying the numeric value (e.g., WIDGETSTYLE0 + WIDGETNOVALUE).void draw(void)
---Draw widget value. Convert the current value of the widget and draw the ticker representing the value.void drawFace(void)
---Draw widget face. Draw image/diagram representing the widget's face.
MicroViewSlider
MicroViewSlider(uint8_t newx, uint8_t newy, int16_t min, int16_t max)
---MicroViewSlider class initialization. Initialize the MicroViewSlider widget with default style.MicroViewSlider(uint8_t newx, uint8_t newy, int16_t min, int16_t max, uint8_t sty)
---Initialize the MicroViewSlider widget with style WIDGETSTYLE0 or WIDGETSTYLE1 or WIDGETSTYLE2 (like 0, but vertical) or WIDGETSTYLE3 (like 1, but vertical). Add WIDGETNOVALUE to the style to suppress displaying the numeric value (e.g., WIDGETSTYLE0 + WIDGETNOVALUE).void draw(void)
---Draw widget value. Convert the current value of the widget and draw the ticker representing the value.void drawFace(void)
---Draw widget face. Draw image/diagram representing the widget's face.
MISC Under-the-Hood Functions
void checkComm(void)
---Listen for serial command. Instruct the MicroView to check for serial command from the UART.virtual size_t write(* uint8_t)
---Override Arduino's Print. Arduino's print overridden so that we can use uView.print().void data(* uint8_t c)
---SPI data. Send 1 data byte via SPI to SSD1306 controller.void setColumnAddress(* uint8_t add)
---Set SSD1306 column address. Send column address command and address to the SSD1306 OLED controller.void setPageAddress(* uint8_t add)
---Set SSD1306 page address. Send page address command and address to the SSD1306 OLED controller.void doCmd(* uint8_t index)
---Parse command. Command stored in serCmd array will be parsed to performed draw functions.void command(* uint8_t c)
---Send 1 command byte.void command(* uint8_t c1, * uint8_t c2)
---Send 2 command bytes.void command(* uint8_t c1, * uint8_t c2, * uint8_t c3)
---Send 3 command bytes.uint8_t * getScreenBuffer(void)
---Get pointer to screen buffer. Return a pointer to the start of the RAM screen buffer for direct access.
MVSPIClass Reference (MicroView SPI)
static void begin()
---SPI Initialization. Set up SCK, MOSI, SS and DC pins for SPI transmission.static void end()
---End SPI.static void wait()
---Wait for SPI serial transfer complete.static void transfer(byte _data)
---Transfer data byte via SPI port.static void packetBegin()
---Set up to begin a SPI packet transmit. Set up SPI for transmitting. Prepare the SPI interface for transmitting 1 or more bytes of commands and/or data.static void packetEnd()
---End an SPI packet transmission:- Wait for the last byte to finish being transmitted.
- Set DC to command mode (even if already set that way, just in case).
- Set SS high.
- Disable SPI mode (causing SCK and MOSI to go low).
static void attachInterrupt()
static void detachInterrupt()
static void setBitOrder(uint8_t)
---Set SPI port bit order with LSBFIRST or MSBFIRST.static void setDataMode(uint8_t)
---Set the SPI data mode: clock polarity and phase. mode - SPI_MODE0, SPI_MODE1, SPI_MODE2, SPI_MODE3.static void setClockDivider(uint8_t)
---Set the clock divider of the SPI; default is 4Mhz.- rate: SPI_CLOCK_DIV2 SPI_CLOCK_DIV4 SPI_CLOCK_DIV8 SPI_CLOCK_DIV16 SPI_CLOCK_DIV32 SPI_CLOCK_DIV64 SPI_CLOCK_DIV128