public void cursor() throws IOException { displaycontrol |= LCD_CURSORON; command(LCD_DISPLAYCONTROL | displaycontrol); }
public void autoscroll() throws IOException { displaymode |= LCD_ENTRYSHIFTINCREMENT; command(LCD_ENTRYMODESET | displaymode); }
public void setCursor(int col, int row) throws IOException { int[] rowOffsets = {0x00, 0x40, 0x14, 0x54}; if (row >= numlines) { row = numlines - 1; // we count rows starting w/0 } command(LCD_SETDDRAMADDR | (col + rowOffsets[row])); }
public void leftToRight() throws IOException { displaymode |= LCD_ENTRYLEFT; command(LCD_ENTRYMODESET | displaymode); }
public void noDisplay() throws IOException { displaycontrol &= ~LCD_DISPLAYON; command(LCD_DISPLAYCONTROL | displaycontrol); }
public void noBlink() throws IOException { displaycontrol &= ~LCD_BLINKON; command(LCD_DISPLAYCONTROL | displaycontrol); }
public void rightToLeft() throws IOException { displaymode &= ~LCD_ENTRYLEFT; command(LCD_ENTRYMODESET | displaymode); }
public void noAutoscroll() throws IOException { displaymode &= ~LCD_ENTRYSHIFTINCREMENT; command(LCD_ENTRYMODESET | displaymode); }
public void blink() throws IOException { displaycontrol |= LCD_BLINKON; command(LCD_DISPLAYCONTROL | displaycontrol); }
public void display() throws IOException { displaycontrol |= LCD_DISPLAYON; command(LCD_DISPLAYCONTROL | displaycontrol); }
public void noCursor() throws IOException { displaycontrol &= ~LCD_CURSORON; command(LCD_DISPLAYCONTROL | displaycontrol); }
public void scrollDisplayLeft() throws IOException { command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT); }
public void scrollDisplayRight() throws IOException { command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT); }
public void createChar(int location, int[] charmap) throws IOException { location &= 0x7; // we only have 8 locations 0-7 command(LCD_SETCGRAMADDR | (location << 3)); for (int i = 0; i < 8; i++) { write(charmap[i]); } }
/********** * high level commands, for the user! */ public void clear() throws IOException { command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero delayMicroseconds(2000); // this command takes a long time! }
public void home() throws IOException { command(LCD_RETURNHOME); // set cursor position to zero delayMicroseconds(2000); // this command takes a long time! }