#define LCD_CMD_DISPLAY_CTRL 0x08 /* Display control */ #define LCD_CMD_DISPLAY_ON 0x04 /* Set display on */ #define LCD_CMD_CURSOR_ON 0x02 /* Set cursor on */ #define LCD_CMD_BLINK_ON 0x01 /* Set blink on */
#define LCD_CMD_SHIFT 0x10 /* Shift cursor/display */ #define LCD_CMD_DISPLAY_SHIFT 0x08 /* Shift display instead of cursor */ #define LCD_CMD_SHIFT_RIGHT 0x04 /* Shift display/cursor to the right */
#define LCD_CMD_FUNCTION_SET 0x20 /* Set function */ #define LCD_CMD_DATA_LEN_8BITS 0x10 /* Set data length to 8 bits */ #define LCD_CMD_TWO_LINES 0x08 /* Set to two display lines */ #define LCD_CMD_FONT_5X10_DOTS 0x04 /* Set char font to 5x10 dots */
#define LCD_CMD_SET_CGRAM_ADDR 0x40 /* Set char generator RAM address */
#define LCD_CMD_SET_DDRAM_ADDR 0x80 /* Set display data RAM address */
/* sleeps that many milliseconds with a reschedule */ staticvoid long_sleep(int ms)
{
schedule_timeout_interruptible(msecs_to_jiffies(ms));
}
int hd44780_common_print(struct charlcd *lcd, int c)
{ struct hd44780_common *hdc = lcd->drvdata;
if (lcd->addr.x < hdc->bwidth) {
hdc->write_data(hdc, c); return 0;
}
/* * we force the cursor to stay at the end of the * line if it wants to go farther
*/
addr = x < hdc->bwidth ? x & (hdc->hwidth - 1) : hdc->bwidth - 1; if (y & 1)
addr += hdc->hwidth; if (y & 2)
addr += hdc->bwidth;
hdc->write_cmd(hdc, LCD_CMD_SET_DDRAM_ADDR | addr); return 0;
}
EXPORT_SYMBOL_GPL(hd44780_common_gotoxy);
/* * The Hitachi HD44780 controller (and compatible ones) reset the DDRAM * address when executing the DISPLAY_CLEAR command, thus the * following call is not required. However, other controllers do not * (e.g. NewHaven NHD-0220DZW-AG5), thus move the cursor to home * unconditionally to support both.
*/ return hd44780_common_home(lcd);
}
EXPORT_SYMBOL_GPL(hd44780_common_clear_display);
int hd44780_common_init_display(struct charlcd *lcd)
{ struct hd44780_common *hdc = lcd->drvdata;
void (*write_cmd_raw)(struct hd44780_common *hdc, int cmd);
u8 init;
if (hdc->ifwidth != 4 && hdc->ifwidth != 8) return -EINVAL;
if (dir == CHARLCD_SHIFT_LEFT) { /* back one char if not at end of line */ if (lcd->addr.x < hdc->bwidth)
hdc->write_cmd(hdc, LCD_CMD_SHIFT);
} elseif (dir == CHARLCD_SHIFT_RIGHT) { /* allow the cursor to pass the end of the line */ if (lcd->addr.x < (hdc->bwidth - 1))
hdc->write_cmd(hdc,
LCD_CMD_SHIFT | LCD_CMD_SHIFT_RIGHT);
}
int hd44780_common_redefine_char(struct charlcd *lcd, char *esc)
{ /* Generator : LGcxxxxx...xx; must have <c> between '0' * and '7', representing the numerical ASCII code of the * redefined character, and <xx...xx> a sequence of 16 * hex digits representing 8 bytes for each character. * Most LCDs will only use 5 lower bits of the 7 first * bytes.
*/
struct hd44780_common *hdc = lcd->drvdata; unsignedchar cgbytes[8]; unsignedchar cgaddr; int cgoffset; int shift; char value; int addr;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.