Cursor update. Cursor not visible anymore by default.

This commit is contained in:
robijn
2002-03-25 23:19:41 +00:00
parent 1e7a4a44bc
commit f2c77241eb
+10 -9
View File
@@ -328,7 +328,7 @@ sed1330_init( Driver * drvthis, char *args )
// Init cursor p // Init cursor p
p->cursor_x = 1; p->cursor_x = 1;
p->cursor_y = 1; p->cursor_y = 1;
p->cursor_state = 1; p->cursor_state = CURSOR_OFF;
// Allocate framebuffer // Allocate framebuffer
p->framebuf_text = (unsigned char *) malloc( p->bytesperline * p->height ); p->framebuf_text = (unsigned char *) malloc( p->bytesperline * p->height );
@@ -450,27 +450,28 @@ void sed1330_update_cursor( PrivateData * p )
csrloc[1] = cursor_pos / 256; csrloc[1] = cursor_pos / 256;
switch( p->cursor_state ) { switch( p->cursor_state ) {
case 0: // Off case CURSOR_OFF: // Off
fc = 0; fc = 0;
csrform[0] = 0x04; csrform[0] = 0x04;
csrform[1] = 0x07; csrform[1] = 0x07;
break; break;
case 1: // Underlined case CURSOR_DEFAULT_ON:
case CURSOR_UNDER: // Underlined
fc = 2; fc = 2;
csrform[0] = 0x04; csrform[0] = 0x04;
csrform[1] = 0x07; csrform[1] = 0x07;
break; break;
case 2: // Block case CURSOR_BLOCK: // Block
fc = 2; fc = 2;
break;
csrform[0] = 0x84; csrform[0] = 0x84;
csrform[1] = 0x07; csrform[1] = 0x07;
break;
} }
disp_en = 0x14 + fc; disp_en = 0x14 + fc;
sed1330_command( p, CMD_CSRW, 2, csrloc ); sed1330_command( p, CMD_CSRW, 2, csrloc );
sed1330_command( p, CMD_DISP_EN, 1, &disp_en ); // cursor on sed1330_command( p, CMD_DISP_EN, 1, &disp_en ); // set cursor on/off
sed1330_command( p, CMD_CSR_FORM, 2, csrform ); // 5x8 cursor sed1330_command( p, CMD_CSR_FORM, 2, csrform ); // set cursor shape
} }
@@ -545,8 +546,8 @@ sed1330_string( Driver * drvthis, int x, int y, char *str )
// Calculate where to start and length to write // Calculate where to start and length to write
start = p->framebuf_text + (y-1)*p->bytesperline + (x-1); start = p->framebuf_text + (y-1)*p->bytesperline + (x-1);
len = strlen(str); len = strlen(str);
if( p->width < len ) { if( p->width <= len ) {
len = p->width; len = p->width - x + 1;
} }
memcpy( start, str, len ); memcpy( start, str, len );