Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Added support or interrupts #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions LiquidCrystal_I2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ void LiquidCrystal_I2C::begin() {

/********** high level commands, for the user! */
void LiquidCrystal_I2C::clear(){
cli();
command(LCD_CLEARDISPLAY);// clear display, set cursor position to zero
delayMicroseconds(2000); // this command takes a long time!
sei();
}

void LiquidCrystal_I2C::home(){
Expand All @@ -103,11 +105,13 @@ void LiquidCrystal_I2C::home(){
}

void LiquidCrystal_I2C::setCursor(uint8_t col, uint8_t row){
cli();
int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
if (row > _rows) {
row = _rows-1; // we count rows starting w/0
}
command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
sei();
}

// Turn the display on/off (quickly)
Expand All @@ -116,8 +120,10 @@ void LiquidCrystal_I2C::noDisplay() {
command(LCD_DISPLAYCONTROL | _displaycontrol);
}
void LiquidCrystal_I2C::display() {
cli();
_displaycontrol |= LCD_DISPLAYON;
command(LCD_DISPLAYCONTROL | _displaycontrol);
sei();
}

// Turns the underline cursor on/off
Expand All @@ -126,8 +132,10 @@ void LiquidCrystal_I2C::noCursor() {
command(LCD_DISPLAYCONTROL | _displaycontrol);
}
void LiquidCrystal_I2C::cursor() {
cli();
_displaycontrol |= LCD_CURSORON;
command(LCD_DISPLAYCONTROL | _displaycontrol);
sei();
}

// Turn on and off the blinking cursor
Expand Down Expand Up @@ -175,11 +183,13 @@ void LiquidCrystal_I2C::noAutoscroll(void) {
// Allows us to fill the first 8 CGRAM locations
// with custom characters
void LiquidCrystal_I2C::createChar(uint8_t location, uint8_t charmap[]) {
cli();
location &= 0x7; // we only have 8 locations 0-7
command(LCD_SETCGRAMADDR | (location << 3));
for (int i=0; i<8; i++) {
write(charmap[i]);
}
sei();
}

// Turn the (optional) backlight off/on
Expand Down