Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SSD1351 Class Reference
OLED Display Driver for Hexiwear. More...
#include <Hexi_OLED_SSD1351.h>
Public Member Functions | |
| SSD1351 (PinName mosiPin, PinName sclkPin, PinName pwrPin, PinName csPin, PinName rstPin, PinName dcPin) | |
| Create a Hexiwear OLED Driver connected to the specified pins. | |
| ~SSD1351 () | |
| Destroy the Hexiwear instance. | |
| void | SendCmd (uint32_t cmd, uint8_t isFirst) |
| Send the command to OLED. | |
| void | SendData (const uint8_t *dataToSend, uint32_t dataSize) |
| Send data to OLED. | |
| oled_status_t | DrawBox (int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height, uint16_t color) |
| draw box on OLED | |
| void | FillScreen (uint16_t color) |
| Fill the entire screen with specified color. | |
| oled_status_t | DrawPixel (int8_t xCrd, int8_t yCrd, uint16_t color) |
| Draw a single pixel. | |
| oled_status_t | DrawScreen (const uint8_t *image, int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height, oled_transition_t transition) |
| Draw the whole screen. | |
| oled_status_t | SetFont (const uint8_t *newFont, uint16_t newColor) |
| Set the font to use. | |
| void | SetDynamicArea (oled_dynamic_area_t *dynamic_area) |
| Set OLED dynamic area. | |
| void | DestroyDynamicArea () |
| Destroy current OLED dynamic area. | |
| void | SetTextProperties (oled_text_properties_t *textProperties) |
| Set OLED class text properties from parameter. | |
| void | GetTextProperties (oled_text_properties_t *textProperties) |
| Copy OLED class text properties to parameter. | |
| uint8_t | GetTextWidth (const uint8_t *text) |
| Return the width in [px] required for the given string to be displayed. | |
| uint8_t | CharCount (uint8_t width, const uint8_t *font, const uint8_t *text, uint8_t length) |
| Count the characters. | |
| oled_status_t | AddText (const uint8_t *text, int8_t xCrd, int8_t yCrd) |
| Add text to the main screen buffer at position x,y. | |
| oled_status_t | AddText (const uint8_t *text) |
| Add text to the main screen buffer. | |
| oled_status_t | DrawText (const uint8_t *text) |
| Write text on OLED at position set in Dynamic Area Field. | |
| void | GetImageDimensions (uint8_t *width, uint8_t *height, const uint8_t *image) |
| Return the dimensions of image. | |
| oled_status_t | AddImage (const uint8_t *image) |
| Add image to the main screen buffer.Used with SetDynamicArea() Function. | |
| oled_status_t | AddImage (const uint8_t *image, int8_t xCrd, int8_t yCrd) |
| Add image to the main screen buffer at position x,y. | |
| oled_status_t | DrawImage (const uint8_t *image) |
| Send image to OLED GRAM.Used with SetDynamicArea() Function for positioning image. | |
| oled_status_t | DrawImage (const uint8_t *image, int8_t xCrd, int8_t yCrd) |
| Send image to OLED GRAM at position x,y. | |
| void | DimScreenON () |
| Dim OLED screen on. | |
| void | DimScreenOFF () |
| Return OLED back to full contrast. | |
| void | Swap (oled_pixel_t imgDst, const uint8_t *imgSrc, uint16_t imgSize) |
| Swap image's bytes per pixel to obtain the correct color format. | |
| void | PowerON () |
| Turn on Power for OLED Display. | |
| void | PowerOFF () |
| Turn off Power for OLED Display. | |
| void | UpdateBuffer (int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height, const uint8_t *image) |
| update the main screen buffer with the given image | |
| oled_status_t | Label (const uint8_t *text, int8_t xCrd, int8_t yCrd) |
| Write text on OLED at position x,y. | |
| oled_status_t | TextBox (const uint8_t *text, int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height) |
| Create a text box of width,height at position x,y. | |
Detailed Description
OLED Display Driver for Hexiwear.
Definition at line 46 of file Hexi_OLED_SSD1351.h.
Constructor & Destructor Documentation
| SSD1351 | ( | PinName | mosiPin, |
| PinName | sclkPin, | ||
| PinName | pwrPin, | ||
| PinName | csPin, | ||
| PinName | rstPin, | ||
| PinName | dcPin | ||
| ) |
Create a Hexiwear OLED Driver connected to the specified pins.
- Parameters:
-
mosiPin SPI Master Out, Slave In Pin sclkPin SPI CLock Pin pwrPin OLED Power Pin csPin OLED Chip Select Pin rstPin OLED Reset Pin dcPin OLED DC Pin
- Note:
- Default TextProperties
.font = OpenSans_10x15_Regular, .fontColor = COLOR_WHITE, .alignParam = OLED_TEXT_ALIGN_CENTER, .background = NULL
Definition at line 86 of file Hexi_OLED_SSD1351.cpp.
| ~SSD1351 | ( | void | ) |
Destroy the Hexiwear instance.
Definition at line 128 of file Hexi_OLED_SSD1351.cpp.
Member Function Documentation
| oled_status_t AddImage | ( | const uint8_t * | image ) |
Add image to the main screen buffer.Used with SetDynamicArea() Function.
- Parameters:
-
image desired image
- Returns:
- status flag
Definition at line 763 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t AddImage | ( | const uint8_t * | image, |
| int8_t | xCrd, | ||
| int8_t | yCrd | ||
| ) |
Add image to the main screen buffer at position x,y.
- Parameters:
-
image desired image xCrd image x-coordinate yCrd image y-coordinate
- Returns:
- status flag
Definition at line 786 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t AddText | ( | const uint8_t * | text, |
| int8_t | xCrd, | ||
| int8_t | yCrd | ||
| ) |
Add text to the main screen buffer at position x,y.
- Parameters:
-
text text to add xCrd x-coordinate for the given text yCrd y-coordinate for the given text
- Returns:
- status flag
Definition at line 498 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t AddText | ( | const uint8_t * | text ) |
Add text to the main screen buffer.
Used with SetDynamicArea() Function.
- Parameters:
-
text text to add
- Returns:
- status flag
set default values, if necessary
write the characters into designated space, one by one
Definition at line 615 of file Hexi_OLED_SSD1351.cpp.
| uint8_t CharCount | ( | uint8_t | width, |
| const uint8_t * | font, | ||
| const uint8_t * | text, | ||
| uint8_t | length | ||
| ) |
Count the characters.
- Parameters:
-
width text width font text font text given text string length text length
- Returns:
- character count
Definition at line 472 of file Hexi_OLED_SSD1351.cpp.
| void DestroyDynamicArea | ( | ) |
Destroy current OLED dynamic area.
Definition at line 425 of file Hexi_OLED_SSD1351.cpp.
| void DimScreenOFF | ( | ) |
Return OLED back to full contrast.
Definition at line 868 of file Hexi_OLED_SSD1351.cpp.
| void DimScreenON | ( | ) |
Dim OLED screen on.
Definition at line 856 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t DrawBox | ( | int8_t | xCrd, |
| int8_t | yCrd, | ||
| uint8_t | width, | ||
| uint8_t | height, | ||
| uint16_t | color | ||
| ) |
draw box on OLED
- Parameters:
-
xCrd x-coordinate for box's uper left corner yCrd y-coordinate for box's uper left corner width box's width height box's height color color of the box
- Returns:
- status flag
Definition at line 203 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t DrawImage | ( | const uint8_t * | image, |
| int8_t | xCrd, | ||
| int8_t | yCrd | ||
| ) |
Send image to OLED GRAM at position x,y.
- Parameters:
-
image desired image xCrd image x-coordinate yCrd image y-coordinate
- Returns:
- status flag
Definition at line 836 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t DrawImage | ( | const uint8_t * | image ) |
Send image to OLED GRAM.Used with SetDynamicArea() Function for positioning image.
- Parameters:
-
image desired image
- Returns:
- status flag
Definition at line 818 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t DrawPixel | ( | int8_t | xCrd, |
| int8_t | yCrd, | ||
| uint16_t | color | ||
| ) |
Draw a single pixel.
- Parameters:
-
xCrd pixel's x coordinate yCrd pixel's y coordinate color pixel's color
- Returns:
- status flag
Definition at line 297 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t DrawScreen | ( | const uint8_t * | image, |
| int8_t | xCrd, | ||
| int8_t | yCrd, | ||
| uint8_t | width, | ||
| uint8_t | height, | ||
| oled_transition_t | transition | ||
| ) |
Draw the whole screen.
- Parameters:
-
image image to draw xCrd image x-coordinate yCrd image y-coordinate width image width height image height transition transition style for the new image arrival
- Returns:
- status flag
Definition at line 328 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t DrawText | ( | const uint8_t * | text ) |
Write text on OLED at position set in Dynamic Area Field.
Used with SetDynamicArea() Function.
- Parameters:
-
text desired text
Definition at line 737 of file Hexi_OLED_SSD1351.cpp.
| void FillScreen | ( | uint16_t | color ) |
Fill the entire screen with specified color.
fill the entire screen
- Parameters:
-
color color to fill with color color to fill with
- Returns:
- status flag
Definition at line 278 of file Hexi_OLED_SSD1351.cpp.
| void GetImageDimensions | ( | uint8_t * | width, |
| uint8_t * | height, | ||
| const uint8_t * | image | ||
| ) |
Return the dimensions of image.
- Parameters:
-
width given image's width height given image's height image desired image
Definition at line 756 of file Hexi_OLED_SSD1351.cpp.
| void GetTextProperties | ( | oled_text_properties_t * | textProperties ) |
Copy OLED class text properties to parameter.
- Parameters:
-
textProperties destination data-structure
Definition at line 445 of file Hexi_OLED_SSD1351.cpp.
| uint8_t GetTextWidth | ( | const uint8_t * | text ) |
Return the width in [px] required for the given string to be displayed.
- Parameters:
-
text desired string
- Returns:
- required text width in [px]
Definition at line 453 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t Label | ( | const uint8_t * | text, |
| int8_t | xCrd, | ||
| int8_t | yCrd | ||
| ) |
Write text on OLED at position x,y.
Recommended for Static Text.
- Parameters:
-
text desired text xCrd x-coordinate for the given text yCrd y-coordinate for the given text
Definition at line 927 of file Hexi_OLED_SSD1351.cpp.
| void PowerOFF | ( | ) |
Turn off Power for OLED Display.
Definition at line 898 of file Hexi_OLED_SSD1351.cpp.
| void PowerON | ( | ) |
Turn on Power for OLED Display.
Definition at line 893 of file Hexi_OLED_SSD1351.cpp.
| void SendCmd | ( | uint32_t | cmd, |
| uint8_t | isFirst | ||
| ) |
Send the command to OLED.
- Parameters:
-
cmd OLED command from the datasheet isFirst designate if this is the first byte in the command
Definition at line 138 of file Hexi_OLED_SSD1351.cpp.
| void SendData | ( | const uint8_t * | dataToSend, |
| uint32_t | dataSize | ||
| ) |
Send data to OLED.
- Parameters:
-
dataToSend data to send to OLED dataSize data-size
Definition at line 167 of file Hexi_OLED_SSD1351.cpp.
| void SetDynamicArea | ( | oled_dynamic_area_t * | dynamic_area ) |
Set OLED dynamic area.
- Parameters:
-
dynamic_area data-structure with desired values
Definition at line 402 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t SetFont | ( | const uint8_t * | newFont, |
| uint16_t | newColor | ||
| ) |
Set the font to use.
- Parameters:
-
newFont desired font newColor desired color
- Returns:
- status flag
Definition at line 383 of file Hexi_OLED_SSD1351.cpp.
| void SetTextProperties | ( | oled_text_properties_t * | textProperties ) |
Set OLED class text properties from parameter.
- Parameters:
-
textProperties data-structure with desired properties
Definition at line 435 of file Hexi_OLED_SSD1351.cpp.
| void Swap | ( | oled_pixel_t | imgDst, |
| const uint8_t * | imgSrc, | ||
| uint16_t | imgSize | ||
| ) |
Swap image's bytes per pixel to obtain the correct color format.
- Parameters:
-
imgDst desired image imgSrc original image imgSize image's size
Definition at line 876 of file Hexi_OLED_SSD1351.cpp.
| oled_status_t TextBox | ( | const uint8_t * | text, |
| int8_t | xCrd, | ||
| int8_t | yCrd, | ||
| uint8_t | width, | ||
| uint8_t | height | ||
| ) |
Create a text box of width,height at position x,y.
Recommended for Dynamic Text. Text is aligned in textbox accordingly to the align parameter set by SetTextProperties().
- Parameters:
-
text desired text xCrd x-coordinate for the textbox yCrd y-coordinate for the textbox width width of the textbox height height of the textbox
Definition at line 948 of file Hexi_OLED_SSD1351.cpp.
| void UpdateBuffer | ( | int8_t | xCrd, |
| int8_t | yCrd, | ||
| uint8_t | width, | ||
| uint8_t | height, | ||
| const uint8_t * | image | ||
| ) |
update the main screen buffer with the given image
- Parameters:
-
xCrd image x-coordinate yCrd image y-coordinate width image width height image height image image for buffer
Definition at line 906 of file Hexi_OLED_SSD1351.cpp.
Generated on Sun Jul 17 2022 02:10:46 by
1.7.2