From 01600bdbb13652c73d7399dfa1f31871cb712466 Mon Sep 17 00:00:00 2001 From: marschap Date: Tue, 25 Apr 2006 07:50:06 +0000 Subject: [PATCH] add cursor() method --- server/drivers/CFontzPacket.c | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/server/drivers/CFontzPacket.c b/server/drivers/CFontzPacket.c index d5b17c6..aaa1c86 100644 --- a/server/drivers/CFontzPacket.c +++ b/server/drivers/CFontzPacket.c @@ -1466,6 +1466,44 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon) } +/* + * * Sets cursor position and state + */ +MODULE_EXPORT void +CFontzPacket_cursor (Driver *drvthis, int x, int y, int state) +{ + PrivateData *p = (PrivateData *) drvthis->private_data; + + if (p->model != 633) { + unsigned char cpos[2] = { 0, 0 }; + + /* set cursor state */ + switch (state) { + case CURSOR_OFF: // no cursor + send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 0); + break; + case CURSOR_UNDER: // underline cursor + send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 2); + break; + case CURSOR_BLOCK: // inverting blinking block + send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 4); + break; + case CURSOR_DEFAULT_ON: // blinking block + default: + send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 1); + break; + } + + /* set cursor position */ + if ((x > 0) && (x <= p->width)) + cpos[0] = x - 1; + if ((y > 0) && (y <= p->height)) + cpos[1] = y - 1; + send_bytes_message(p->fd, CF633_Set_LCD_Cursor_Position, 2, cpos); + } +} + + /* * Clears the LCD screen */