EA DOGM128 Driver  0.1
Driver code for the EA DOGM128
 All Files Functions Typedefs Enumerations Groups Pages
Macros | Functions
Characters

Macros

#define DOG_CHAR_WIDTH   126
 
#define DOG_CHAR_HEIGHT   8
 
#define DOG_HIDDEN_MICKEY   128
 

Functions

int putchar (int c)
 
int8_t dog_set_page (uint8_t new_page)
 
int8_t dog_set_column (uint8_t new_col)
 
int8_t dog_putchar_select (uint8_t row, uint8_t new_col, char c)
 

Detailed Description

This file contains function prototypes to write characters to the DOGM128. It contains a 5x7 ASCII character set and functions so that the user only needs to pass chars when placing a character on the screen rather than manually setting each individual pixel. Note that the functions included in this file DO NOT assume that the user has initialized the display.

Macro Definition Documentation

#define DOG_CHAR_HEIGHT   8

Number of pages on the display. Included for consistency.

#define DOG_CHAR_WIDTH   126

Max line width. Note that characters are 5x7 pixels wide (actually 6x7 when we take into account the automatic 1-column wide space added to the buffer after almost all characters. Due to this restriction, we can only print up to 126/6 = 21 characters per line. 128/6 is not a whole number, hence why we cannot print to the whole width of the display.

#define DOG_HIDDEN_MICKEY   128

Surprise character, just for fun!

Function Documentation

int8_t dog_putchar_select ( uint8_t  row,
uint8_t  new_col,
char  c 
)

This function is used to write a character to the screen at any row (not page) or column on the screen regardless of the current cursor position. In other words, the character being written to the screen is not restricted to a particular page or column. NOTE: This function does not1 move the current position; it will assume its old position before the function returns.

Parameters
  • row = The desired row to place the character relative to the top of character.
  • new_col = The desired column to place the character to the left hand side of the character.
  • c = The character to be written to the screen.
Algorithm
Ensures that the provided row and column are within range. It then determines the page or pages in which the character will be placed on and the portion of the character that will be placed on each page. Next it looks up the character's bitmap in the character lookup table and places it in the screen buffer.
Assumptions
  • None
Returns
Upon successful completion, the function returns zero. Otherwise it returns -1.
int8_t dog_set_column ( uint8_t  new_col)

This function is used to set the column where putchar() will begin writing a character to the screen (starting at the left-side of the letter).

Parameters
  • new_col = The new column number to be set. The value should be between 0 and 122.
Algorithm
Ensures that parameter new_col is within a valid range. If it is within range, it sets the static variable col equal to new_col. Otherwise, col remains unchanged.
Assumptions
  • None
Returns
Upon successful completion, the function returns zero. Otherwise it returns -1.
int8_t dog_set_page ( uint8_t  new_page)

This function is used to set the page where putchar() will begin writing a character to the screen.

Parameters
  • new_page = The new page number to be set. The value should be between 0 and 7.
Algorithm
Ensures that parameter new_page is within a valid range. If it is within range, it sets the static variable page equal to new_page. Otherwise, page remains unchanged.
Assumptions
  • None
Returns
Upon successful completion, the function returns zero. Otherwise it returns -1.
int putchar ( int  c)

This function is used by printf() to place individual characters on the print buffer; however, it may also be used standalone as well.

Parameters
  • c = The character to be printed to the display buffer. It is of type int rather than char to fit the predefined prototype in the stdio.h header.
Algorithm
The function keeps track of the current column and page between subsequent calls. It begins by checking if c is a newline character and will increment to the next page accordingly. Otherwise, it will then check if the end of line has been reached (and if so, it will increment to the next page. It subsequently checks that the last page has not been reached (if it has, it will wrap around to the top of the display). Finally, it looks up the character's bitmap in a lookup table and prints that to the display buffer contained in the common.c file.
Assumptions
  • The user has no data they wish to leave on the screen that is in the path of the characters. That is, the user must be welcoming to the fact that all pixels along a (6*n)x8 path (where n is the number of characters printed) will be erased to make way for the characters.
Returns
Upon sucessful completion, the original character c is returned.