inc/picotk.h File Reference

#include <stdbool.h>
#include <wchar.h>
#include "framebuffer.h"

Include dependency graph for picotk.h:

This graph shows which files directly or indirectly include this file:


Data Structures

struct  picotk_stFont
 Font structure. More...
struct  picotk_stColor
 Color structure. More...
struct  picotk_stPixmap
 Pixmap structure which stores pixmaps in RGB565 format. More...
struct  picotk_Terminal_st
 Terminal structure. More...

Typedefs

typedef enum picotk_enBuffer picotk_Buffer
 Destination buffer enum.
typedef picotk_stFont picotk_Font
 Font structure.
typedef picotk_stColor picotk_Color
 Color structure.
typedef enum picotk_enPixmapType picotk_PixmapType
typedef picotk_stPixmap picotk_Pixmap
 Pixmap structure which stores pixmaps in RGB565 format.
typedef picotk_Terminal_st picotk_Terminal
 Terminal structure.

Enumerations

enum  picotk_enBuffer { LCD_FB, LCD_BB, LCD_SB, PTK_TERM }
 Destination buffer enum. More...
enum  picotk_enPixmapType { PICOTK_RGB565, PICOTK_RGB5A1 }

Functions

int picotk_Init (isrDisp_t *isrDisp)
 Initializes picoTK and the display with the given ISR dispatcher.
void picotk_EnableDebug (int debug)
 Enable debugging messages (i.e.
void picotk_Show ()
 Show the contents of the latest framebuffer onto the display.
void picotk_ShowNB ()
 Begins to show the display, but does not block.
void picotk_ReadyToDraw ()
 If picotk_ShowNB() was previously calls, waits until the display has finished refreshing.
void picotk_DestSet (picotk_Buffer destination)
 Sets the destination buffer to destination.
void picotk_DrawPoint (picotk_Color *color, int x, int y)
 Draws a point at the given coordinates.
void picotk_DrawLine (picotk_Color *color, int x1, int y1, int x2, int y2)
 Draws a one pixel wide line between (x1, y1) and (x2,y2) using the provided color.
int picotk_DrawText (picotk_Font *font, picotk_Color *color, int x, int y, char *txt)
 Draws text starting at x, y (upper left corner of rectangle around text) with the provided font and color.
int picotk_DrawTextCentered (picotk_Font *font, picotk_Color *color, int x, int y, char *text)
 Similar to picotk_DrawText() but centered around x position, i.e.
int picotk_TextWidth (picotk_Font *font, char *txt)
 Calculates the text's width in pixels, given a font and the text.
int picotk_TextHeight (picotk_Font *font, char *txt)
 Calculates the text's height in pixels, given a font and the text.
void picotk_PixmapInit (picotk_Pixmap *pixmap, int width, int height, picotk_PixmapType type, const unsigned short *data)
 Given a pointer to a newly-allocated picotk_Pixmap, initializes its contents with the provided pixmap data.
void picotk_PixmapDraw (picotk_Pixmap *pixmap, int x, int y)
 Draws a pixmap at the given coordinates (upper left corner of rectangle around pixmap).
void picotk_DrawRect (picotk_Color *color, int x, int y, int w, int h)
 Draws a rectangle with an lower left corner at (x,y) and upper right corner at (x+w-1,y+h-1).
void picotk_FillRect (picotk_Color *color, int x, int y, int w, int h)
 Draws a filled rectangle with the top left corner at (x,y) and the lower right corner at (x+w-1,y+h-1).
void picotk_DrawCircle (picotk_Color *color, int x, int y, int r)
 Draws a circle (outline, not filled).
void picotk_FillCircle (picotk_Color *color, int x, int y, int r)
 Draws a filled circle.
void picotk_Scroll (int x, int y, int w, int h, int delta)
 Vertically scrolls an area with an upper left corner at (x,y) and a lower right corner at (x+w-1,y+h-1).
void picotk_TerminalInit (picotk_Terminal *term, int wc, int hc, picotk_Font *font, picotk_Color *fgColor, picotk_Color *bgColor)
void picotk_TerminalPutc (picotk_Terminal *term, int ch)
 Types a single character into given terminal.
void picotk_TerminalPrintf (picotk_Terminal *term, char *fmt,...)
 Types characters into the terminal according to the format string and the following parameters.
void picotk_TerminalDraw (picotk_Terminal *term, int x, int y)
int picotk_slackGet (void)
 Returns the nanosecs until the pending image switch is executed, or 0 if no switch is pending.
void picotk_plotSlackBar (picotk_Color *color, int x, int y, unsigned char horizontal, unsigned short maxLen)
 Plots slack on a 1 pixel wide bar graph.
int picotk_statsGet (unsigned int *nrUpdates, unsigned int *nrSame)
 Gathers display statistics.

Variables

picotk_Font picotk_font_10x20
picotk_Font picotk_font_5x7
picotk_Font picotk_font_6x12
picotk_Font picotk_font_8x13
picotk_Font picotk_font_helv_b34
picotk_Font picotk_font_helv_m20
picotk_Font picotk_font_helv_m24
picotk_Font picotk_font_helv_m25
picotk_Font picotk_font_helv_m34
picotk_Font picotk_font_school_m34

Typedef Documentation

typedef enum picotk_enBuffer picotk_Buffer

Destination buffer enum.

typedef struct picotk_stColor picotk_Color

Color structure.

typedef struct picotk_stFont picotk_Font

Font structure.

typedef struct picotk_stPixmap picotk_Pixmap

Pixmap structure which stores pixmaps in RGB565 format.

typedef enum picotk_enPixmapType picotk_PixmapType

typedef struct picotk_Terminal_st picotk_Terminal

Terminal structure.


Enumeration Type Documentation

enum picotk_enBuffer

Destination buffer enum.

Enumerator:
LCD_FB 
LCD_BB  foreground buffer
LCD_SB  background buffer
PTK_TERM  draw to a picoTK terminal

enum picotk_enPixmapType

Enumerator:
PICOTK_RGB565 
PICOTK_RGB5A1 


Function Documentation

void picotk_DestSet ( picotk_Buffer  destination  ) 

Sets the destination buffer to destination.

Parameters:
destination The destination buffer

void picotk_DrawCircle ( picotk_Color color,
int  x,
int  y,
int  r 
)

Draws a circle (outline, not filled).

Parameters:
color The color of the circle
x The x-coordinate of the center of the circle
y The y-coordinate of the center of the circle
r The radius of the circle

void picotk_DrawLine ( picotk_Color color,
int  x1,
int  y1,
int  x2,
int  y2 
)

Draws a one pixel wide line between (x1, y1) and (x2,y2) using the provided color.

Parameters:
color 
x1 
y1 
x2 
y2 

void picotk_DrawPoint ( picotk_Color color,
int  x,
int  y 
)

Draws a point at the given coordinates.

Parameters:
color The color of the point
x The x position of the point
y The y position of the point

void picotk_DrawRect ( picotk_Color color,
int  x,
int  y,
int  w,
int  h 
)

Draws a rectangle with an lower left corner at (x,y) and upper right corner at (x+w-1,y+h-1).

Parameters:
color pointer to picotk_Color struct
x,y top left coordinates of rectangle
w,h width and height of rectangle

int picotk_DrawText ( picotk_Font font,
picotk_Color color,
int  x,
int  y,
char *  txt 
)

Draws text starting at x, y (upper left corner of rectangle around text) with the provided font and color.

Parameters:
font 
color 
x 
y 
txt 

int picotk_DrawTextCentered ( picotk_Font font,
picotk_Color color,
int  x,
int  y,
char *  text 
)

Similar to picotk_DrawText() but centered around x position, i.e.

text extends to left and right of x to the same amount.

Parameters:
font 
color 
x 
y 
text 

void picotk_EnableDebug ( int  debug  ) 

Enable debugging messages (i.e.

out of bounds checking). Disable for performance

Parameters:
debug 1 to enable, 0 to disable

void picotk_FillCircle ( picotk_Color color,
int  x,
int  y,
int  r 
)

Draws a filled circle.

Parameters:
color The color of the circle
x The x-coordinate of the center of the circle
y The y-coordinate of the center of the circle
r The radius of the circle

void picotk_FillRect ( picotk_Color color,
int  x,
int  y,
int  w,
int  h 
)

Draws a filled rectangle with the top left corner at (x,y) and the lower right corner at (x+w-1,y+h-1).

int picotk_Init ( isrDisp_t isrDisp  ) 

Initializes picoTK and the display with the given ISR dispatcher.

Clears (color=0) the display canvas. picoTK uses a canvas with an origin in the upper left corner. One LSB in the coordinate system equals a single pixel.

void picotk_PixmapDraw ( picotk_Pixmap pixmap,
int  x,
int  y 
)

Draws a pixmap at the given coordinates (upper left corner of rectangle around pixmap).

Parameters:
pixmap 
x 
y 

void picotk_PixmapInit ( picotk_Pixmap pixmap,
int  width,
int  height,
picotk_PixmapType  type,
const unsigned short *  data 
)

Given a pointer to a newly-allocated picotk_Pixmap, initializes its contents with the provided pixmap data.

This function only needs to be called once; you will still have to call picotk_DrawPixmap() to actually draw the pixmap onto a framebuffer.

Parameters:
pixmap The pixmap struct to initialize
height 
width 
type 
data A pointer to the contents of the pixmap; this depends on the pixma's type

void picotk_plotSlackBar ( picotk_Color color,
int  x,
int  y,
unsigned char  horizontal,
unsigned short  maxLen 
)

Plots slack on a 1 pixel wide bar graph.

Assumption: frame rate 30Hz

void picotk_ReadyToDraw (  ) 

If picotk_ShowNB() was previously calls, waits until the display has finished refreshing.

If you do not call this function, the display may not be fully updated by the time you call picotk_ShowNB() again.

void picotk_Scroll ( int  x,
int  y,
int  w,
int  h,
int  delta 
)

Vertically scrolls an area with an upper left corner at (x,y) and a lower right corner at (x+w-1,y+h-1).

The area is scrolled by delta pixels. If delta is positive the area is scrolled up; otherwise it is scrolled down.

Parameters:
x 
y 
w 
h 
delta The offset to scroll by (scrolled up if positive)

void picotk_Show (  ) 

Show the contents of the latest framebuffer onto the display.

Note that this function blocks until the frame has been committed and the next one prepared. If you intend to do some processing in between frames, call picotk_ShowNB(), perform your calculations, and then call picotk_ReadyToDraw().

void picotk_ShowNB (  ) 

Begins to show the display, but does not block.

Note that this function does not block; you can perform other calculations, but still need to draw picotk_ReadyToDraw() to ensure the frame syncing is done correctly

int picotk_slackGet ( void   ) 

Returns the nanosecs until the pending image switch is executed, or 0 if no switch is pending.

Returns nanoSec until pending image switch is executed, 0 if no switch is pending.

Pre-conditions:

Post condtions:

Parameters:

Parameters:
state address of LCD state variable
Returns:
nanoseconds until pending switch occurs

int picotk_statsGet ( unsigned int *  nrUpdates,
unsigned int *  nrSame 
)

Gathers display statistics.

gathers display statistics nrUpdates number of images updated nrSame number of identical images displayed

Pre-conditions:

Post condtions:

Parameters:

Parameters:
state address of LCD state variable
Returns:
int status (0 for success, -1 for failure)

void picotk_TerminalDraw ( picotk_Terminal term,
int  x,
int  y 
)

void picotk_TerminalInit ( picotk_Terminal term,
int  wc,
int  hc,
picotk_Font font,
picotk_Color fgColor,
picotk_Color bgColor 
)

void picotk_TerminalPrintf ( picotk_Terminal term,
char *  fmt,
  ... 
)

Types characters into the terminal according to the format string and the following parameters.

It is compatible to how POSIX printf() handles its format string. Special character are interpreted by the terminal just as with picotk_TerminalPutc().

void picotk_TerminalPutc ( picotk_Terminal term,
int  ch 
)

Types a single character into given terminal.

The terminal handles some special ASCII characters as such, including \r (ADE 13) \n (ADE 10).

int picotk_TextHeight ( picotk_Font font,
char *  txt 
)

Calculates the text's height in pixels, given a font and the text.

Parameters:
font 
txt 

int picotk_TextWidth ( picotk_Font font,
char *  txt 
)

Calculates the text's width in pixels, given a font and the text.

Parameters:
font 
txt 


Variable Documentation

picotk_Font picotk_font_10x20

picotk_Font picotk_font_5x7

picotk_Font picotk_font_6x12

picotk_Font picotk_font_8x13

picotk_Font picotk_font_helv_b34

picotk_Font picotk_font_helv_m20

picotk_Font picotk_font_helv_m24

picotk_Font picotk_font_helv_m25

picotk_Font picotk_font_helv_m34

picotk_Font picotk_font_school_m34


Generated on 3 Mar 2014 for PAL bare-c Library by  doxygen 1.4.7