Skip to content

Commit 4de3f01

Browse files
author
Owen L - SFE
committed
Add convenience for HyperDisplay text functions
1 parent 9343762 commit 4de3f01

File tree

2 files changed

+41
-19
lines changed

2 files changed

+41
-19
lines changed

src/HyperDisplay_SSD1309.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,24 @@ void SSD1309::hwpixel(hd_hw_extent_t x0, hd_hw_extent_t y0, color_t data, hd_col
188188

189189
// Functions that don't need color arguments, for simplicity.
190190

191+
void SSD1309::setWindowColorSet(wind_info_t* pwindow){
192+
if(pwindow == NULL){
193+
setWindowColorSequence(pCurrentWindow, (color_t)(&colorSet));
194+
}
195+
else{
196+
setWindowColorSequence(pwindow, (color_t)(&colorSet));
197+
}
198+
}
199+
200+
void SSD1309::setWindowColorClear(wind_info_t* pwindow){
201+
if(pwindow == NULL){
202+
setWindowColorSequence(pCurrentWindow, (color_t)(&colorClear));
203+
}
204+
else{
205+
setWindowColorSequence(pwindow, (color_t)(&colorClear));
206+
}
207+
}
208+
191209
void SSD1309::windowSet(wind_info_t* pwindow)
192210
{
193211
wind_info_t* ptemp = NULL;

src/HyperDisplay_SSD1309.h

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -180,30 +180,34 @@ class SSD1309 : virtual public hyperdisplay{
180180

181181
public:
182182

183+
SSD1309_Bite_t colorSet = {0x01};
184+
SSD1309_Bite_t colorClear = {0x00};
185+
183186
// Here is the main API implementation that allows this class to hook into the hyperdisplay library
184-
void hwpixel(hd_hw_extent_t x0, hd_hw_extent_t y0, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0); // Single pixel write. Required by hyperdisplay. Uses screen-relative coordinates
185-
// void hwxline(hd_hw_extent_t x0, hd_hw_extent_t y0, hd_hw_extent_t len, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool goLeft = false); // More efficient xline imp. Uses screen-relative coordinates
186-
// void hwyline(hd_hw_extent_t x0, hd_hw_extent_t y0, hd_hw_extent_t len, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool goUp = false); // More efficient yline imp. Uses screen-relative coordinates
187-
// void hwrectangle(hd_hw_extent_t x0, hd_hw_extent_t y0, hd_hw_extent_t x1, hd_hw_extent_t y1, bool filled = false, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool reverseGradient = false, bool gradientVertical = false); // More efficient rectangle imp in window-relative coordinates
188-
// void hwfillFromArray(hd_hw_extent_t x0, hd_hw_extent_t y0, hd_hw_extent_t x1, hd_hw_extent_t y1, color_t data = NULL, hd_pixels_t numPixels = 0, bool Vh = false ); // More efficient fill from array implementation. Uses screen-relative coordinates
187+
void hwpixel(hd_hw_extent_t x0, hd_hw_extent_t y0, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0); // Single pixel write. Required by hyperdisplay. Uses screen-relative coordinates
188+
// void hwxline(hd_hw_extent_t x0, hd_hw_extent_t y0, hd_hw_extent_t len, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool goLeft = false); // More efficient xline imp. Uses screen-relative coordinates
189+
// void hwyline(hd_hw_extent_t x0, hd_hw_extent_t y0, hd_hw_extent_t len, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool goUp = false); // More efficient yline imp. Uses screen-relative coordinates
190+
// void hwrectangle(hd_hw_extent_t x0, hd_hw_extent_t y0, hd_hw_extent_t x1, hd_hw_extent_t y1, bool filled = false, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool reverseGradient = false, bool gradientVertical = false); // More efficient rectangle imp in window-relative coordinates
191+
// void hwfillFromArray(hd_hw_extent_t x0, hd_hw_extent_t y0, hd_hw_extent_t x1, hd_hw_extent_t y1, color_t data = NULL, hd_pixels_t numPixels = 0, bool Vh = false ); // More efficient fill from array implementation. Uses screen-relative coordinates
189192

190193

191-
// Functions that don't need color arguments, for simplicity.
192-
194+
// Functions that don't need color arguments, for simplicity.
195+
void setWindowColorSet(wind_info_t* pwindow = NULL);
196+
void setWindowColorClear(wind_info_t* pwindow = NULL);
193197
void windowSet(wind_info_t* pwindow = NULL);
194198
void windowClear(wind_info_t* pwindow = NULL);
195-
void pixelSet(hd_extent_t x0, hd_extent_t y0);
196-
void pixelClear(hd_extent_t x0, hd_extent_t y0);
197-
void rectangleSet(hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, bool filled = false);
198-
void rectangleClear(hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, bool filled = false);
199-
#if HYPERDISPLAY_DRAWING_LEVEL > 0
200-
void lineSet(hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, uint16_t width = 1);
201-
void lineClear(hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, uint16_t width = 1);
202-
void polygonSet(hd_extent_t x[], hd_extent_t y[], uint8_t numSides, uint16_t width = 1);
203-
void polygonClear(hd_extent_t x[], hd_extent_t y[], uint8_t numSides, uint16_t width = 1);
204-
void circleSet(hd_extent_t x0, hd_extent_t y0, hd_extent_t radius, bool filled = false);
205-
void circleClear(hd_extent_t x0, hd_extent_t y0, hd_extent_t radius, bool filled = false);
206-
#endif /* HYPERDISPLAY_DRAWING_LEVEL > 0 */
199+
void pixelSet(hd_extent_t x0, hd_extent_t y0);
200+
void pixelClear(hd_extent_t x0, hd_extent_t y0);
201+
void rectangleSet(hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, bool filled = false);
202+
void rectangleClear(hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, bool filled = false);
203+
#if HYPERDISPLAY_DRAWING_LEVEL > 0
204+
void lineSet(hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, uint16_t width = 1);
205+
void lineClear(hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, uint16_t width = 1);
206+
void polygonSet(hd_extent_t x[], hd_extent_t y[], uint8_t numSides, uint16_t width = 1);
207+
void polygonClear(hd_extent_t x[], hd_extent_t y[], uint8_t numSides, uint16_t width = 1);
208+
void circleSet(hd_extent_t x0, hd_extent_t y0, hd_extent_t radius, bool filled = false);
209+
void circleClear(hd_extent_t x0, hd_extent_t y0, hd_extent_t radius, bool filled = false);
210+
#endif /* HYPERDISPLAY_DRAWING_LEVEL > 0 */
207211

208212
// Here are all of the settings you can change on the SSD1309 - they use the writeBytes API
209213
// Fundamental Commands

0 commit comments

Comments
 (0)