27 #if defined(__cplusplus) // If compiling for C++ 32 #include "simpletools.h" 66 #ifndef INTF_SPI_NO_BUFFER 67 #define INTF_SPI_NO_BUFFER 0b00 70 #ifndef INTF_SPI_WITH_BUFFER 71 #define INTF_SPI_WITH_BUFFER 0b10 74 #ifndef INTF_I2C_NO_BUFFER 75 #define INTF_I2C_NO_BUFFER 0b01 78 #ifndef INTF_I2C_WITH_BUFFER 79 #define INTF_I2C_WITH_BUFFER 0b11 84 #define gfx_swap(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) // No-temp-var swap operation 88 #define absv(x) ((x)<0 ? -(x) : (x)) 831 #if defined(__cplusplus) 837 #endif // _SCREEN_GFX_ char * customCharSmall
Definition: simplegfx.h:187
void drawCircle(screen_t *dev, int x0, int y0, int r, int color)
Draws a circle in the specified color.
Definition: drawCircle.c:29
void setTextWrap(screen_t *dev, char w)
Toggles automatic wrapping of text printed to the screen.
Definition: setText.c:56
int cursor_y
Definition: simplegfx.h:125
void drawFastVLine(screen_t *dev, int x, int y, int h, int color)
Draws a vertical line in the specified color.
Definition: drawLine.c:199
char * customCharLarge
Definition: simplegfx.h:193
void(* deviceDrawPixel)(struct screen_st *, int x, int y, int color)
Definition: simplegfx.h:207
void drawCharMedium(screen_t *dev, unsigned char c)
Low-level helper function for printing single characters to the screen in the medium (11x15) font...
Definition: drawChar.c:149
int display_mode
Definition: simplegfx.h:146
void(* deviceUpdateDisplay)(struct screen_st *)
Definition: simplegfx.h:232
int image_size
Definition: simplegfx.h:180
void(* deviceDrawLine)(struct screen_st *, int x, int y, int w, int h, int color)
Definition: simplegfx.h:213
void drawLine(screen_t *dev, int x0, int y0, int x1, int y1, int color)
Draws a line in the specified color.
Definition: drawLine.c:43
int bg_color
Definition: simplegfx.h:143
char(* deviceWriteLock)(void)
Definition: simplegfx.h:197
char color_depth
Definition: simplegfx.h:131
void fillCircle(screen_t *dev, int x0, int y0, int r, int color)
Draws a filled circle in the specified color.
Definition: fillCircle.c:27
int getCursorX(screen_t *dev)
Returns the current horizontal position of the cursor, measured from the left side of the screen in p...
char dc_pin
Definition: simplegfx.h:176
i2c * deviceBus
Definition: simplegfx.h:154
int rotation
Definition: simplegfx.h:119
unsigned char getScrollVertical(screen_t *dev)
Returns a value representing the status or speed of the display's vertical scroll.
Definition: displayControl.c:95
void drawRect(screen_t *dev, int x, int y, int w, int h, int color)
Draws a rectangle in the specified color.
Definition: drawRect.c:29
void(* deviceWriteLockSet)(struct screen_st *)
Definition: simplegfx.h:200
void drawCharSmall(screen_t *dev, unsigned char c)
Low-level helper function for printing single characters to the screen in the small (5x7) font...
Definition: drawChar.c:127
char isInverted(screen_t *dev)
Returns the status of the screen's colors - normal or inverted.
Definition: displayControl.c:83
void(* deviceInvertDisplay)(struct screen_st *, char i)
Definition: simplegfx.h:238
void(* deviceSleepWakeDisplay)(struct screen_st *, char i)
Definition: simplegfx.h:241
void drawFastHLine(screen_t *dev, int x, int y, int w, int color)
Draws a horizontal line in the specified color.
Definition: drawLine.c:164
void sleepWakeDisplay(screen_t *dev, char i)
Toggle the display's sleep/wake mode. Not supported by all displays.
Definition: displayControl.c:70
Definition: simplegfx.h:111
void resetDisplay(screen_t *dev)
Resets the display.
Definition: displayControl.c:36
void(* deviceWriteLockClear)(struct screen_st *)
Definition: simplegfx.h:203
void setTextSize(screen_t *dev, char s)
Sets the size of the font to be used. Range is from 1 to 3. Size (1) is 5x7 (6x8 spacing) pixels...
Definition: setText.c:37
screen_t screen
Definition: simplegfx.h:248
void drawCircleHelper(screen_t *dev, int x0, int y0, int r, char cornername, int color)
Helper function used to help draw circles and rectangles with rounded corners.
Definition: drawCircleHelper.c:27
int width
Definition: simplegfx.h:113
void drawNumber(screen_t *dev, float d, int r)
Prints a number to the screen starting at the cursor position. Output is limited to 64 bytes...
Definition: drawNumber.c:31
void drawRoundRect(screen_t *dev, int x, int y, int w, int h, int r, int color)
Draws a rectangle with rounded corners in the specified color.
Definition: drawRoundRect.c:27
char getDisplayRotation(screen_t *dev)
Returns the screen's orientation.
Definition: displayControl.c:44
void setBgColor(screen_t *dev, int color)
Sets the color of the font and the color of the background (highlighting) to be used. Setting the text color and text background to the same color will make the background color transparent.
Definition: setText.c:52
void drawCharLarge(screen_t *dev, unsigned char c)
Low-level helper function for printing single characters to the screen in the large (17x23) font...
Definition: drawChar.c:177
char deviceInterface
Definition: simplegfx.h:157
int(* deviceGetPixel)(struct screen_st *, int x, int y)
Definition: simplegfx.h:210
void drawPixel(screen_t *dev, int x, int y, int color)
Draws a single pixel in the specified color.
Definition: drawPixel.c:30
void drawBitmap(screen_t *dev, char *imgdir, int x, int y)
Draw an image (bitmap) at the specified (x,y) position. Requires an SD card to be mounted...
Definition: drawBitmap.c:30
char isAsleep(screen_t *dev)
Returns whether the screen is currently in a sleep mode or awake.
Definition: displayControl.c:87
int getCursorY(screen_t *dev)
Returns the current vertical position of the cursor, measured from the top of the screen in pixels...
void fillCircleHelper(screen_t *dev, int x0, int y0, int r, char cornername, int delta, int color)
Helper function used to draw filled circles and rectangles with rounded corners.
Definition: fillCircleHelper.c:29
int getDisplayHeight(screen_t *dev)
Returns the height of the display in pixels with screen rotation taken into account.
Definition: displayControl.c:56
void(* deviceScrollDisplay)(struct screen_st *, int h, int v)
Definition: simplegfx.h:244
unsigned char getScrollHorizontal(screen_t *dev)
Returns a value representing the status or speed of the display's horizontal scroll.
Definition: displayControl.c:91
void fillRoundRect(screen_t *dev, int x, int y, int w, int h, int r, int color)
Draws a filled rectangle with rounded corners in the specified color.
Definition: fillRoundRect.c:28
char rst_pin
Definition: simplegfx.h:170
int font[5]
Definition: simplegfx.h:128
void(* deviceFillRect)(struct screen_st *, int x, int y, int w, int h, int color)
Definition: simplegfx.h:222
void loadFonts(screen_t *dev, i2c *eeBus)
Internal function used to load the EEPROM addresses of the bitmapped fonts to the device's structure...
Definition: loadSetFonts.c:27
void(* deviceClearDisplay)(struct screen_st *)
Definition: simplegfx.h:229
void invertDisplay(screen_t *dev, char i)
Toggles the invert/normal display modes for the display. Depending on the display type it may only in...
Definition: displayControl.c:64
void setDisplayRotation(screen_t *dev, char r)
Sets the screen's orientation.
Definition: displayControl.c:40
void drawText(screen_t *dev, char *myString)
Prints a string of text to the screen starting at the cursor position. Output is limited to 64 bytes...
Definition: drawText.c:28
unsigned char dev_id
Definition: simplegfx.h:161
void(* deviceDrawFastVLine)(struct screen_st *, int x, int y, int w, int color)
Definition: simplegfx.h:219
char status_pin
Definition: simplegfx.h:164
void setTextFont(screen_t *dev, char f)
Sets the font face to be used. Range is from 0 to 3.
Definition: loadSetFonts.c:47
void(* deviceCopyRect)(struct screen_st *, int x, int y, int x0, int y0, int x1, int y1)
Definition: simplegfx.h:225
void(* deviceDrawFastHLine)(struct screen_st *, int x, int y, int w, int color)
Definition: simplegfx.h:216
void drawCopy(screen_t *dev, int x, int y, int w, int h, int x1, int y1)
Copies a rectagle and draws it at another location on the screen.
Definition: drawCopy.c:29
int text_color
Definition: simplegfx.h:140
void drawChar(screen_t *dev, char c)
Prints single ASCII-encoded characters to the screen. Characters 32 (space) to 126 (~) are rendered...
Definition: drawText.c:35
void setCursor(screen_t *dev, int x, int y, char size)
Sets the cursor position based on the size parameter.
Definition: setText.c:27
char clk_pin
Definition: simplegfx.h:173
char text_size
Definition: simplegfx.h:134
void fillRect(screen_t *dev, int x, int y, int w, int h, int color)
Draws a filled rectangle in the specified color.
Definition: fillRect.c:29
void clearDisplay(screen_t *dev)
Clears (sets to the native background color of the screen, usually black) the entire screen...
Definition: displayControl.c:28
int drawPrint(screen_t *dev, const char *fmt,...)
Print format "..." args to the screen. The output is limited to 128 bytes.
Definition: drawPrint.c:29
struct screen_st screen_t
void fillTriangle(screen_t *dev, int x0, int y0, int x1, int y1, int x2, int y2, int color)
Draws a filled triangle with in the specified color.
Definition: fillTriangle.c:27
char * customCharMed
Definition: simplegfx.h:190
void scrollDisplay(screen_t *dev, int h, int v)
Set the display's vertical or hrizontal scrolling functions. Not supported by all displays...
Definition: displayControl.c:76
int height
Definition: simplegfx.h:116
void setTextColor(screen_t *dev, int color)
Sets the color of the font and the color of the background (highlighting) to be used. Setting the text color and text background to the same color will make the background color transparent.
Definition: setText.c:48
char text_wrap
Definition: simplegfx.h:137
void updateDisplay(screen_t *dev)
Updates the display by writing the image buffer to it. Not necessary for screens that have their own ...
Definition: displayControl.c:32
char * image_ptr
Definition: simplegfx.h:183
void drawTriangle(screen_t *dev, int x0, int y0, int x1, int y1, int x2, int y2, int color)
Draws a triangle with in the specified color.
Definition: drawTriangle.c:27
void(* deviceResetDisplay)(struct screen_st *)
Definition: simplegfx.h:235
int getDisplayWidth(screen_t *dev)
Returns the width of the display in pixels with screen rotation taken into account.
Definition: displayControl.c:48
int cursor_x
Definition: simplegfx.h:122
char sdi_pin
Definition: simplegfx.h:167
i2c * eepromBus
Definition: simplegfx.h:150