GLCD Library
A C Library for Embedded Applications
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
glcd.h File Reference

GLCD Library main header file. More...

#include <stdint.h>
#include "glcd_devices.h"
#include "glcd_controllers.h"
#include "glcd_graphics.h"
#include "glcd_graphs.h"
#include "glcd_text_tiny.h"
#include "glcd_text.h"
#include "unit_tests.h"

Go to the source code of this file.

Data Structures

struct  glcd_BoundingBox_t
 Bounding box for pixels that need to be updated. More...
 
struct  glcd_FontConfig_t
 

Macros

#define GLCD_RESET_TIME   1
 Reset duration by glcd_reset(), in milliseconds. More...
 
#define swap(a, b)   { uint8_t t = a; a = b; b = t; }
 
Colour Constants
#define BLACK   1
 
#define WHITE   0
 
LCD Dimensions
#define GLCD_LCD_WIDTH   0
 User specified GLCD width in pixels Set to 0 for automatic assignment based on controller. More...
 
#define GLCD_LCD_HEIGHT   0
 User specified GLCD height in pixels Set to 0 for automatic assignment based on controller. More...
 
#define GLCD_LCD_WIDTH   128
 User specified GLCD width in pixels Set to 0 for automatic assignment based on controller. More...
 
#define GLCD_LCD_HEIGHT   64
 User specified GLCD height in pixels Set to 0 for automatic assignment based on controller. More...
 
#define GLCD_NUMBER_OF_BANKS   (GLCD_LCD_WIDTH / 8)
 
#define GLCD_NUMBER_OF_COLS   GLCD_LCD_WIDTH
 

Enumerations

enum  font_table_type { STANG, MIKRO }
 

Functions

Base Functions
void glcd_update_bbox (uint8_t xmin, uint8_t ymin, uint8_t xmax, uint8_t ymax)
 Update bounding box. More...
 
void glcd_reset_bbox (void)
 Reset the bounding box. More...
 
void glcd_bbox_reset (void)
 Same as glcd_reset_bbox() More...
 
void glcd_bbox_refresh (void)
 Marks the entire display for re-writing. More...
 
void glcd_clear (void)
 Clear the display. More...
 
void glcd_clear_buffer (void)
 Clear the display buffer only. More...
 
void glcd_select_screen (uint8_t *buffer, glcd_BoundingBox_t *bbox)
 Select screen buffer and bounding box structure. More...
 
void glcd_scroll (int8_t x, int8_t y)
 Scroll entire screne buffer by x and y pixels. More...
 
void glcd_scroll_line (void)
 Scroll screen buffer up by 8 pixels. More...
 

Variables

glcd_FontConfig_t font_current
 
glcd_BoundingBox_t glcd_bbox
 Keeps track of bounding box of area on LCD which need to be updated next reresh cycle. More...
 
glcd_BoundingBox_tglcd_bbox_selected
 Pointer to bounding box currently in use. More...
 
uint8_t glcd_buffer [GLCD_LCD_WIDTH *GLCD_LCD_HEIGHT/8]
 Screen buffer. More...
 
uint8_t * glcd_buffer_selected
 Pointer to screen buffer currently in use. More...
 

Detailed Description

GLCD Library main header file.

This file must be included into project.

Author
Andy Gock

Definition in file glcd.h.

Macro Definition Documentation

#define GLCD_LCD_HEIGHT   64

User specified GLCD height in pixels Set to 0 for automatic assignment based on controller.

Definition at line 141 of file glcd.h.

#define GLCD_LCD_WIDTH   128

User specified GLCD width in pixels Set to 0 for automatic assignment based on controller.

Definition at line 140 of file glcd.h.

#define GLCD_NUMBER_OF_BANKS   (GLCD_LCD_WIDTH / 8)

Definition at line 149 of file glcd.h.

Referenced by glcd_test_rectangles().

#define GLCD_NUMBER_OF_COLS   GLCD_LCD_WIDTH

Definition at line 150 of file glcd.h.

#define GLCD_RESET_TIME   1

Reset duration by glcd_reset(), in milliseconds.

Definition at line 156 of file glcd.h.

#define swap (   a,
 
)    { uint8_t t = a; a = b; b = t; }

Definition at line 90 of file glcd.h.

Referenced by glcd_draw_line().

#define WHITE   0

Definition at line 106 of file glcd.h.

Referenced by glcd_draw_char_xy(), glcd_scrolling_bar_graph(), and glcd_test_circles().

Enumeration Type Documentation

Enumerator
STANG 
MIKRO 

Definition at line 251 of file glcd.h.

Function Documentation

void glcd_bbox_refresh ( void  )

Marks the entire display for re-writing.

Definition at line 114 of file glcd.c.

Referenced by glcd_draw_bitmap().

void glcd_bbox_reset ( void  )

Same as glcd_reset_bbox()

Definition at line 110 of file glcd.c.

void glcd_clear ( void  )

Clear the display.

This will clear the buffer and physically write and commit it to the LCD

Definition at line 122 of file glcd.c.

Referenced by glcd_test_circles(), glcd_test_rectangles(), and glcd_test_scrolling_graph().

void glcd_clear_buffer ( void  )

Clear the display buffer only.

This does not physically write the changes to the LCD

Definition at line 128 of file glcd.c.

Referenced by glcd_test_counter_and_graph(), glcd_test_hello_world(), glcd_test_rectangles(), and glcd_test_text_up_down().

void glcd_reset_bbox ( void  )

Reset the bounding box.

After resetting the bounding box, no pixels are marked as needing refreshing.

Definition at line 101 of file glcd.c.

Referenced by glcd_bbox_reset().

void glcd_scroll ( int8_t  x,
int8_t  y 
)

Scroll entire screne buffer by x and y pixels.

(not implemented yet)

Note
Items scrolled off the extents of the display dimensions will be lost.
Parameters
xX distance to scroll
yY distance to scroll
Todo:
Skeleton

Definition at line 139 of file glcd.c.

void glcd_scroll_line ( void  )

Scroll screen buffer up by 8 pixels.

This is designed to be used in conjunciton with tiny text functions which are 8 bits high.

See Also
Tiny Text

Definition at line 153 of file glcd.c.

Referenced by glcd_tiny_draw_string_ammend(), and glcd_tiny_draw_string_ammend_P().

void glcd_select_screen ( uint8_t *  buffer,
glcd_BoundingBox_t bbox 
)

Select screen buffer and bounding box structure.

This should be selected at initialisation. There are future plans to support multiple screen buffers but this not yet available.

Parameters
bufferPointer to screen buffer
bboxPointer to bounding box object.
See Also
glcd_BoundingBox_t

Definition at line 133 of file glcd.c.

Referenced by glcd_draw_bitmap().

void glcd_update_bbox ( uint8_t  xmin,
uint8_t  ymin,
uint8_t  xmax,
uint8_t  ymax 
)

Update bounding box.

The bounding box defines a rectangle in which needs to be refreshed next time glcd_write() is called. glcd_write() only writes to those pixels inside the bounding box plus any surrounding pixels which are required according to the bank/column write method of the controller.

Define a rectangle here, and it will be added to the existing bounding box.

Parameters
xminMinimum x value of rectangle
yminMinimum y value of rectangle
xmaxMaximum x value of rectangle
ymaxMaximum y value of rectangle
See Also
glcd_bbox
glcd_bbox_selected

Definition at line 69 of file glcd.c.

Referenced by glcd_clear(), glcd_clear_buffer(), glcd_draw_circle(), glcd_draw_line(), glcd_draw_rect(), glcd_draw_rect_thick(), glcd_fill_circle(), glcd_fill_rect(), glcd_invert_pixel(), glcd_scroll_line(), glcd_set_pixel(), glcd_tiny_draw_char(), and glcd_tiny_draw_char_xy().

Variable Documentation