1 // hd-one-line.cxx - description. -*- C++ -*-
3 // Copyright (C) 1999, 2000 Red Hat.
4 // This file is part of SID and is licensed under the GPL.
5 // See the file COPYING.SID for conditions for redistribution.
7 #include "hd-one-line.h"
11 hd_one_line :: init() {
12 put( LCD_IR, 0x30 ); // 1-lines, 5x8 font
13 put( LCD_IR, 1 ); // clear display
14 put( LCD_IR, 0x3 ); // return home
15 put( LCD_IR, 0xc ); // enable display
17 put( LCD_IR, 0x80 ); // select DDRAM address 0
19 for( int i=0; i<8; i++ )
20 put( LCD_DR, 0xa1 + i );
22 put( LCD_IR, 0x7 ); // shift left on input
26 cout << "should see Japanese chars 0xa1-0xa9" << endl;
30 hd_one_line :: draw_char( uchar val ) {
35 hd_one_line :: run( host_int_4 ) {
36 switch( curr_state() ) {
39 yield( SCROLL, 50000 );
43 if( (curr_char & 0x0f) == 0 )
44 cout << "drawing japanese char " << hex << (int)curr_char << dec << endl;
46 draw_char( curr_char );
48 if( curr_char >= 0xe0 )
52 yield( SCROLL, 80000 );
64 cout << "all tests complete: fail count " << fail_count << endl;
70 HD44780UTesterListTypes() {
72 types.push_back(string("hd44780u-tester"));
77 HD44780UTesterCreate( const string& typeName ) {
78 if(typeName == "hd44780u-tester")
79 return new hd_one_line();
85 HD44780UTesterDelete( component* c ) {
86 delete dynamic_cast<hd_one_line*>(c);
91 extern const component_library hd1l_tester_component_library;
93 const component_library hd1l_tester_component_library DLLEXPORT =
95 COMPONENT_LIBRARY_MAGIC,
96 & HD44780UTesterListTypes,
97 & HD44780UTesterCreate,
98 & HD44780UTesterDelete