Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
gfx_library.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void display_drawLine (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color)
 draw line More...
 
void display_drawRect (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color)
 draw rectangle More...
 
void display_fillRect (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color)
 draw filled rectangle More...
 
void display_drawCircle (uint16_t x0, uint16_t y0, uint16_t r, uint16_t color)
 draw circle More...
 
void display_fillCircle (uint16_t x0, uint16_t y0, uint16_t r, uint16_t color)
 draw a filled circle More...
 
void display_setCursor (uint16_t x, uint16_t y)
 Set text cursor location. More...
 
void display_setTextSize (uint8_t s)
 Set text 'magnification' size. More...
 
void display_setTextColor (uint16_t c, uint16_t b)
 Set text font color with custom background color. More...
 
void display_putc (uint8_t c)
 Print one byte/character of data. More...
 
void display_puts (const uint8_t *s)
 Print a string to the display. More...
 
void display_puts_max_n (const uint8_t *s, uint8_t n)
 Print a maximum of (n - 1) characters from the input string to the display and put "..." as the nth character afterwards to indicate that the string was truncated. More...
 
void display_double (char *text, int text_size, double v, int decimalDigits)
 convert a float to a string More...
 
void display_setRotation (uint16_t rotation)
 set the rotation prints starting at the cursor position. More...
 
uint16_t getCursorX (void)
 Get text cursor X location. More...
 
uint16_t getCursorY (void)
 Get text cursor Y location. More...
 
uint16_t display_getWidth ()
 Get display Width. More...
 
uint16_t display_getHeight ()
 Get display Height. More...
 
void display_clear (void)
 clears the frame buffer intializes the background on white. More...
 
void display_fixed_image (const uint8_t *image)
 Displays the image provided, using full update (slow). More...
 
void display_drawTriangle (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
 Draw a triangle with no fill color. More...
 
void display_fillTriangle (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
 Draw a triangle with color-fill. More...
 
void display_drawRoundRect (uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint16_t radius, uint16_t color)
 Draw a rounded rectangle with no fill color. More...
 
void display_fillRoundRect (uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint16_t radius, uint16_t color)
 Draw a rounded rectangle with fill color. More...
 
void display_drawBitmapV1 (uint16_t x, uint16_t y, const uint8_t *bitmap, uint16_t w, uint16_t h, uint16_t color)
 Draw a ROM-resident 1-bit image at the specified (x,y) position, using the specified foreground color (unset bits are transparent). More...
 
void display_drawBitmapV1_bg (uint16_t x, uint16_t y, const uint8_t *bitmap, uint16_t w, uint16_t h, uint16_t color, uint16_t bg)
 Draw a ROM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors. More...
 
void display_drawBitmapV2 (uint16_t x, uint16_t y, const uint8_t *bitmap, uint16_t w, uint16_t h, uint16_t color)
 Draw a ROM-resident 1-bit image at the specified (x,y) position, using the specified foreground color (unset bits are transparent). More...
 
void display_drawBitmapV2_bg (uint16_t x, uint16_t y, const uint8_t *bitmap, uint16_t w, uint16_t h, uint16_t color, uint16_t bg)
 Draw a ROM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors. More...
 
void display_drawPixel (int16_t x, int16_t y, uint16_t color)
 
uint8_t display_getRotation ()
 Get rotation setting for display. More...
 
void display_customChar (const uint8_t *c)
 
void display_drawChar (uint16_t x, uint16_t y, uint8_t c, uint16_t color, uint16_t bg, uint8_t size)
 Draw a single character. More...
 
void display_setContrast (uint32_t contrast)
 
void display_slider (int x, int y, int length, int value)
 
void display_progressbar (int x, int y, int length, int value)
 

Function Documentation

◆ display_clear()

void display_clear ( void  )

clears the frame buffer intializes the background on white.

◆ display_customChar()

void display_customChar ( const uint8_t *  c)

◆ display_double()

void display_double ( char *  text,
int  text_size,
double  v,
int  decimalDigits 
)

convert a float to a string

Parameters
textthe text buffer to write in
text_sizethe size of the text buffer
vthe floating number to display
decimalDigitsthe decimal digit to display

◆ display_drawBitmapV1()

void display_drawBitmapV1 ( uint16_t  x,
uint16_t  y,
const uint8_t *  bitmap,
uint16_t  w,
uint16_t  h,
uint16_t  color 
)

Draw a ROM-resident 1-bit image at the specified (x,y) position, using the specified foreground color (unset bits are transparent).

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
bitmapbyte array with monochrome bitmap
wWidth of bitmap in pixels
hHieght of bitmap in pixels
color16-bit 5-6-5 Color to draw with

◆ display_drawBitmapV1_bg()

void display_drawBitmapV1_bg ( uint16_t  x,
uint16_t  y,
const uint8_t *  bitmap,
uint16_t  w,
uint16_t  h,
uint16_t  color,
uint16_t  bg 
)

Draw a ROM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors.

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
bitmapbyte array with monochrome bitmap
wWidth of bitmap in pixels
hHieght of bitmap in pixels
color16-bit 5-6-5 Color to draw pixels with
bg16-bit 5-6-5 Color to draw background with

◆ display_drawBitmapV2()

void display_drawBitmapV2 ( uint16_t  x,
uint16_t  y,
const uint8_t *  bitmap,
uint16_t  w,
uint16_t  h,
uint16_t  color 
)

Draw a ROM-resident 1-bit image at the specified (x,y) position, using the specified foreground color (unset bits are transparent).

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
bitmapbyte array with monochrome bitmap
wWidth of bitmap in pixels
hHieght of bitmap in pixels
color16-bit 5-6-5 Color to draw pixels with

◆ display_drawBitmapV2_bg()

void display_drawBitmapV2_bg ( uint16_t  x,
uint16_t  y,
const uint8_t *  bitmap,
uint16_t  w,
uint16_t  h,
uint16_t  color,
uint16_t  bg 
)

Draw a ROM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors.

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
bitmapbyte array with monochrome bitmap
wWidth of bitmap in pixels
hHieght of bitmap in pixels
color16-bit 5-6-5 Color to draw pixels with
bg16-bit 5-6-5 Color to draw background with

◆ display_drawChar()

void display_drawChar ( uint16_t  x,
uint16_t  y,
uint8_t  c,
uint16_t  color,
uint16_t  bg,
uint8_t  size 
)

Draw a single character.

Parameters
xBottom left corner x coordinate
yBottom left corner y coordinate
cThe 8-bit font-indexed character (likely ascii)
color16-bit 5-6-5 Color to draw chraracter with
bg16-bit 5-6-5 Color to fill background with (if same as color, no background)
sizeFont magnification level, 1 is 'original' size

◆ display_drawCircle()

void display_drawCircle ( uint16_t  x0,
uint16_t  y0,
uint16_t  r,
uint16_t  color 
)

draw circle

draws a circle

Parameters
x0the x coordinate
y0the y coordinate
rthe radius in pixels
colorthe color of the circle (BLACK or WHITE)

draw circle

Parameters
x0Center-point x coordinate
y0Center-point y coordinate
rRadius of circle
color16-bit 5-6-5 Color to draw with

◆ display_drawLine()

void display_drawLine ( uint16_t  x0,
uint16_t  y0,
uint16_t  x1,
uint16_t  y1,
uint16_t  color 
)

draw line

draws a line. NOTE: Under some circumstances, the line drawn will exceed the bounds of the provided coordinates by 1 pixel. So some trial-error and manual adjustments may be needed when using this function.

Parameters
x0the lower x coordinate
y0the lower y coordinate
x1the higher x coordinate
y1the higher y coordinate
colorthe color of the line (BLACK or WHITE)

draw line

Parameters
x0Start point x coordinate
y0Start point y coordinate
x1End point x coordinate
y1End point y coordinate
color16-bit 5-6-5 Color to draw with

◆ display_drawPixel()

void display_drawPixel ( int16_t  x,
int16_t  y,
uint16_t  color 
)

◆ display_drawRect()

void display_drawRect ( uint16_t  x,
uint16_t  y,
uint16_t  w,
uint16_t  h,
uint16_t  color 
)

draw rectangle

draws a rectangle

Parameters
x0the x coordinate
y0the y coordinate
wthe width of the rectangle
hthe height of the rectangle
colorthe color of the line (BLACK or WHITE)

draw rectangle

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
wWidth in pixels
hHeight in pixels
color16-bit 5-6-5 Color to draw with

◆ display_drawRoundRect()

void display_drawRoundRect ( uint16_t  x,
uint16_t  y,
uint16_t  w,
uint16_t  h,
uint16_t  r,
uint16_t  color 
)

Draw a rounded rectangle with no fill color.

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
wWidth in pixels
hHeight in pixels
rRadius of corner rounding
color16-bit 5-6-5 Color to draw with

◆ display_drawTriangle()

void display_drawTriangle ( uint16_t  x0,
uint16_t  y0,
uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  color 
)

Draw a triangle with no fill color.

Parameters
x0Vertex #0 x coordinate
y0Vertex #0 y coordinate
x1Vertex #1 x coordinate
y1Vertex #1 y coordinate
x2Vertex #2 x coordinate
y2Vertex #2 y coordinate
color16-bit 5-6-5 Color to draw with

◆ display_fillCircle()

void display_fillCircle ( uint16_t  x0,
uint16_t  y0,
uint16_t  r,
uint16_t  color 
)

draw a filled circle

draws a filled circle

Parameters
x0the x coordinate
y0the y coordinate
rthe radius in pixels
colorthe color of the circle (BLACK or WHITE)

draw a filled circle

Parameters
x0Center-point x coordinate
y0Center-point y coordinate
rRadius of circle
color16-bit 5-6-5 Color to fill with

◆ display_fillRect()

void display_fillRect ( uint16_t  x,
uint16_t  y,
uint16_t  w,
uint16_t  h,
uint16_t  color 
)

draw filled rectangle

draws a filled rectangle

Parameters
x0the x coordinate
y0the y coordinate
wthe width of the rectangle
hthe height of the rectangle
colorthe color of the line (BLACK or WHITE)

◆ display_fillRoundRect()

void display_fillRoundRect ( uint16_t  x,
uint16_t  y,
uint16_t  w,
uint16_t  h,
uint16_t  r,
uint16_t  color 
)

Draw a rounded rectangle with fill color.

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
wWidth in pixels
hHeight in pixels
rRadius of corner rounding
color16-bit 5-6-5 Color to draw/fill with

◆ display_fillTriangle()

void display_fillTriangle ( uint16_t  x0,
uint16_t  y0,
uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  color 
)

Draw a triangle with color-fill.

Parameters
x0Vertex #0 x coordinate
y0Vertex #0 y coordinate
x1Vertex #1 x coordinate
y1Vertex #1 y coordinate
x2Vertex #2 x coordinate
y2Vertex #2 y coordinate
color16-bit 5-6-5 Color to fill/draw with

◆ display_fixed_image()

void display_fixed_image ( const uint8_t *  image)

Displays the image provided, using full update (slow).

Parameters
imageThe image to be displayed.

◆ display_getHeight()

uint16_t display_getHeight ( void  )

Get display Height.

Returns
Height in pixels

Get display Height.

Returns
Height in pixels

◆ display_getRotation()

uint8_t display_getRotation ( void  )

Get rotation setting for display.

Returns
0 thru 3 corresponding to 4 cardinal rotations

◆ display_getWidth()

uint16_t display_getWidth ( void  )

Get display Width.

Returns
width in pixels

Get display Width.

Returns
Width in pixels

◆ display_progressbar()

void display_progressbar ( int  x,
int  y,
int  length,
int  value 
)

◆ display_putc()

void display_putc ( uint8_t  c)

Print one byte/character of data.

Parameters
cThe 8-bit ascii character to write

note use snprintf to format text

Parameters
cThe 8-bit ascii character to write

◆ display_puts()

void display_puts ( const uint8_t *  s)

Print a string to the display.

Parameters
sThe string to write

note use snprintf to format text snprintf does not display floating numbers use display_double() to display floating numbers

◆ display_puts_max_n()

void display_puts_max_n ( const uint8_t *  s,
uint8_t  n 
)

Print a maximum of (n - 1) characters from the input string to the display and put "..." as the nth character afterwards to indicate that the string was truncated.

Parameters
sThe input string to write (will be truncated if longer than n characters)
nThe maximum number of characters (minus 1 to leave space for "...") to display from the input string NOTE: This is only the number of VISIBLE characters, so excludes NULL terminator.

note use snprintf to format text snprintf does not display floating numbers use display_double() to display floating numbers

EXAMPLE: const char *str = "Hello, World!"; display_puts_max_n(s, 30); // Result is: Hello, World! display_puts_max_n(s, 9); // Result is: Hello, W...

◆ display_setContrast()

void display_setContrast ( uint32_t  contrast)

◆ display_setCursor()

void display_setCursor ( uint16_t  x,
uint16_t  y 
)

Set text cursor location.

Parameters
xX coordinate in pixels
yY coordinate in pixels

◆ display_setRotation()

void display_setRotation ( uint16_t  rotation)

set the rotation prints starting at the cursor position.

Parameters
rotation0 == no rotation, 1 = 90 degrees

◆ display_setTextColor()

void display_setTextColor ( uint16_t  c,
uint16_t  b 
)

Set text font color with custom background color.

Parameters
cBLACK or WHITE
bBLACK or WHITE
c16-bit 5-6-5 Color to draw text with
b16-bit 5-6-5 Color to draw background/fill with

◆ display_setTextSize()

void display_setTextSize ( uint8_t  s)

Set text 'magnification' size.

Each increase in s makes 1 pixel that much bigger.

Parameters
sDesired text size. 1 is default 6x8, 2 is 12x16, 3 is 18x24, etc

◆ display_slider()

void display_slider ( int  x,
int  y,
int  length,
int  value 
)

◆ getCursorX()

uint16_t getCursorX ( void  )

Get text cursor X location.

Returns
X coordinate in pixels

◆ getCursorY()

uint16_t getCursorY ( void  )

Get text cursor Y location.

Returns
Y coordinate in pixels