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.
69 lines
2.5 KiB
69 lines
2.5 KiB
/* 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: */
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#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);
|
|
|
|
// 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).
|
|
void LCD_setChar(char character, int x, int y, bool bw);
|
|
|
|
// setStr draws a string of characters, calling setChar with
|
|
// progressive coordinates until it's done.
|
|
// This function was grabbed from the SparkFun ColorLCDShield
|
|
// library.
|
|
void LCD_setStr(char * dString, int x, int y, bool bw);
|
|
|
|
// 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);
|
|
|
|
/* Invert colors */
|
|
void LCD_invertDisplay(bool in_data);
|
|
|
|
/* Invert colors (hard change in data; does NOT send to display immediately) */
|
|
void LCD_invertDisplayData();
|
|
|
|
//This sends the magical commands to the PCD8544
|
|
void LCD_setup(void);
|
|
|