ATtiny85 Template Code
Code snippets for the ATtiny85
|
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Macros | |
#define | LCD_COL 84 |
#define | LCD_ROW 6 |
Functions | |
void | lcdInit () |
void | lcdData (uint8_t data) |
void | lcdCommand (uint8_t cmd) |
void | lcdClear (bool invert) |
void | lcdClearRow (uint8_t row, bool invert) |
void | lcdPrintChar (uint8_t row, uint8_t col, char ch, bool invert) |
void | lcdPrint (uint8_t row, uint8_t col, const char *str, bool invert) |
void | lcdPrintP (uint8_t row, uint8_t col, const char *str, bool invert) |
void | lcdImageP (uint8_t row, uint8_t col, const uint8_t *img, bool invert) |
#define LCD_COL 84 |
Number of columns
Definition at line 16 of file nokialcd.h.
#define LCD_ROW 6 |
Number of text rows
Definition at line 19 of file nokialcd.h.
void lcdClear | ( | bool | invert | ) |
Clear the screen
Clear the entire display.
invert | if true the colors are inverted and the screen will be filled with black. |
void lcdClearRow | ( | uint8_t | row, |
bool | invert | ||
) |
Clear a single row
Clears a single character row from the left edge of the screen to the right.
row | the row number (0 to 5) to clear. |
invert | if true the colors are inverted and the screen will be filled with black. |
void lcdCommand | ( | uint8_t | cmd | ) |
Send a command byte to the LCD
cmd | the command byte to send. |
void lcdData | ( | uint8_t | data | ) |
Send a data byte to the LCD
data | the data byte to send. |
void lcdImageP | ( | uint8_t | row, |
uint8_t | col, | ||
const uint8_t * | img, | ||
bool | invert | ||
) |
Display an arbitrary graphic on the display
This function is used to display user defined graphics held in PROGMEM to the display. The first byte of the graphic indicates the height (in 8 pixel rows) and the width (in pixel columns) packed as HHWWWWWW giving a maximum size of 4 rows (32 pixels) by 64 pixels for a single image. Images that will display off the edge of the screen are clipped. The packed version of the width and height are 1 less than the actual width and height.
The image is packed as a sequence of 8 pixel vertical strips.
row | the row number (0 to 5) to start the top left of the image. |
col | the column number (0 to 83) to start the top left of the image. |
img | pointer to the image in PROGMEM. |
invert | if true the pixel colors will be inverted. |
void lcdInit | ( | ) |
Initialise the LCD
Sets up the pins required to communicate with the LCD screen and then does the actual chipset initialisation. The pin numbers to use are defined in hardware.h.
void lcdPrint | ( | uint8_t | row, |
uint8_t | col, | ||
const char * | str, | ||
bool | invert | ||
) |
Write a nul terminated string
Display a string of ASCII characters at the position described by the row and column parameters. Note that the row indicates an 8 pixel high character row while the column represents individual pixels. This code uses a built in character set where each character is 6 pixels wide.
This function does not perform any word wrapping or other text layout functions. If the string exceeds the size of the display it will simply be clipped.
row | the row number (0 to 5) to display the character. |
col | the column position (0 to 83) for the start of the left side of the character. |
str | the string to display. If a character in the string is out of range it will be replaced with the '?' character. |
invert | if true the colors are inverted and the character will be displayed as white on black. |
void lcdPrintChar | ( | uint8_t | row, |
uint8_t | col, | ||
char | ch, | ||
bool | invert | ||
) |
Write a single character
Display a single ASCII character at the position described by the row and column parameters. Note that the row indicates an 8 pixel high character row while the column represents individual pixels. This code uses a built in character set where each character is 5 pixels wide and adds a single column of pixels as spacing giving a total width of 6 pixels.
row | the row number (0 to 5) to display the character. |
col | the column position (0 to 83) for the start of the left side of the character. |
ch | the character to display. If the character is out of range it will be replaced with the '?' character. |
invert | if true the colors are inverted and the character will be displayed as white on black. |
void lcdPrintP | ( | uint8_t | row, |
uint8_t | col, | ||
const char * | str, | ||
bool | invert | ||
) |
Write a nul terminated string from PROGMEM
Display a string of ASCII characters at the position described by the row and column parameters. Note that the row indicates an 8 pixel high character row while the column represents individual pixels. This code uses a built in character set where each character is 6 pixels wide.
This function does not perform any word wrapping or other text layout functions. If the string exceeds the size of the display it will simply be clipped.
row | the row number (0 to 5) to display the character. |
col | the column position (0 to 83) for the start of the left side of the character. |
str | the string to display. If a character in the string is out of range it will be replaced with the '?' character. |
invert | if true the colors are inverted and the character will be displayed as white on black. |