You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.9 KiB
84 lines
2.9 KiB
5 years ago
|
/* Pin definitions:
|
||
|
Most of these pins can be moved to any digital or analog pin.
|
||
|
DN(MOSI)and SCLK should be left where they are (SPI pins). The
|
||
|
LED (backlight) pin should remain on a PWM-capable pin. */
|
||
|
// SCE - Chip select, pin 3 on LCD.
|
||
|
// RST - Reset, pin 4 on LCD.
|
||
|
// DC - Data/Command, pin 5 on LCD.
|
||
|
// DN(MOSI) - Serial data, pin 6 on LCD.
|
||
|
// SCLK - Serial clock, pin 7 on LCD.
|
||
|
// LED - Backlight LED, pin 8 on LCD.
|
||
|
|
||
|
/* 84x48 LCD Defines: */
|
||
5 years ago
|
#include <stdbool.h>
|
||
|
#include <stdint.h>
|
||
5 years ago
|
#include "utf8.h"
|
||
5 years ago
|
|
||
5 years ago
|
#define LCD_WIDTH 84 // Note: x-coordinates go wide
|
||
|
#define LCD_HEIGHT 48 // Note: y-coordinates go high
|
||
|
#define WHITE 0 // For drawing pixels. A 0 draws white.
|
||
|
#define BLACK 1 // A 1 draws black.
|
||
|
|
||
|
// This function sets a pixel on displayMap to your preferred
|
||
|
// color. 1=Black, 0= white.
|
||
|
void LCD_setPixel(int x, int y, bool bw);
|
||
|
|
||
|
// setLine draws a line from x0,y0 to x1,y1 with the set color
|
||
|
void LCD_setLine(int x0, int y0, int x1, int y1, bool bw);
|
||
|
|
||
|
// setRect will draw a rectangle from x0,y0 top-left corner to
|
||
|
// a x1,y1 bottom-right corner. Can be filled with the fill
|
||
|
// parameter, and colored with bw.
|
||
|
void LCD_setRect(int x0, int y0, int x1, int y1, bool fill, bool bw);
|
||
|
|
||
|
// setCircle draws a circle centered around x0,y0 with a defined
|
||
|
// radius. The circle can be black or white. And have a line
|
||
|
// thickness ranging from 1 to the radius of the circle.
|
||
|
void LCD_setCircle (int x0, int y0, int radius, bool bw, int lineThickness);
|
||
|
|
||
5 years ago
|
/*
|
||
|
FONT FUNCTIONS
|
||
|
size = 1 ... normal
|
||
|
size = 2 ... 2x
|
||
|
size = 3 ... normal bold
|
||
|
size | 0x80 ... clear background behind characters
|
||
|
*/
|
||
|
|
||
|
|
||
5 years ago
|
// This function will draw a char (defined in the ASCII table
|
||
|
// near the beginning of this sketch) at a defined x and y).
|
||
|
// The color can be either black (1) or white (0).
|
||
5 years ago
|
void LCD_setChar(struct Utf8Char character, int x, int y, bool bw);
|
||
|
|
||
|
void LCD_setCharEx(struct Utf8Char character, int x, int y, bool bw, uint8_t size);
|
||
5 years ago
|
|
||
|
// setStr draws a string of characters, calling setChar with
|
||
|
// progressive coordinates until it's done.
|
||
|
// This function was grabbed from the SparkFun ColorLCDShield
|
||
|
// library.
|
||
5 years ago
|
void LCD_setStr(const char * dString, int x, int y, bool bw);
|
||
5 years ago
|
|
||
5 years ago
|
void LCD_setStrEx(const char *dString, int x, int y, bool bw, uint8_t size);
|
||
|
|
||
5 years ago
|
// This function clears the entire display either white (0) or
|
||
|
// black (1).
|
||
|
// The screen won't actually clear until you call updateDisplay()!
|
||
|
void LCD_clearDisplay(bool bw);
|
||
|
|
||
|
// This will actually draw on the display, whatever is currently
|
||
|
// in the displayMap array.
|
||
|
void LCD_updateDisplay();
|
||
|
|
||
|
// Set contrast can set the LCD Vop to a value between 0 and 127.
|
||
|
// 40-60 is usually a pretty good range.
|
||
|
void LCD_setContrast(uint8_t contrast);
|
||
|
|
||
5 years ago
|
/* Invert colors */
|
||
|
void LCD_invertDisplay(bool in_data);
|
||
|
|
||
|
/* Invert colors (hard change in data; does NOT send to display immediately) */
|
||
|
void LCD_invertDisplayData();
|
||
5 years ago
|
|
||
|
//This sends the magical commands to the PCD8544
|
||
|
void LCD_setup(void);
|