@@ -22,7 +22,7 @@ namespace Hw {
22
22
// -------------------------------------------------------------------
23
23
DisplayChar_DIP204spi::DisplayChar_DIP204spi ( SPImaster::Device &spiIn )
24
24
25
- : DisplayChar( 0 /* todo ... */ , NUM_OF_LINE, NUM_OF_COLUMN ),
25
+ : DisplayChar( 0 /* todo ... */ , NUM_OF_LINE, NUM_OF_COLUMN ),
26
26
spi ( spiIn )
27
27
28
28
{
@@ -44,8 +44,7 @@ void DisplayChar_DIP204spi::gotoTextPos( BYTE lineIn, BYTE columnIn )
44
44
// Startadresse fuer Display-Speicher schreiben
45
45
if ( line < NUM_OF_LINE && column < NUM_OF_COLUMN )
46
46
{
47
- // gotoPos, Format: rrrccccc
48
- writeCmd ( 0x80 | ((line<<5 )+(column&0x1F )) );
47
+ writeCmd ( 0x80 | ((line&0x07 )<<5 ) | (column&0x1F ) );
49
48
}
50
49
}
51
50
@@ -104,31 +103,34 @@ void DisplayChar_DIP204spi::waitBusy( void )
104
103
| (1 <<5 ); // RW
105
104
data[1 ] = 0 ;
106
105
spi.transceive ( data, 2 );
107
- } while ( i-- && data[1 ] & 0x80 );
108
-
109
- // !< \todo i==0 is an Error -> report!
106
+ } while ( --i && data[1 ] & 0x80 );
107
+
108
+ if ( i == 0 )
109
+ {
110
+ report.alert (0 );// !< \todo i==0 is an Error -> report!
111
+ }
110
112
}
111
113
112
114
// -------------------------------------------------------------------
113
115
void DisplayChar_DIP204spi::writeCmd ( BYTE cmd )
114
116
{
115
117
BYTE data[3 ];
116
-
118
+
117
119
data[0 ] = (0x1F ) // START
118
120
| (0 <<6 ) // RS
119
121
| (0 <<5 ); // RW
120
122
data[1 ] = (cmd ) & 0x0F ;
121
123
data[2 ] = (cmd>>4 ) & 0x0F ;
122
124
spi.transceive ( data, 3 );
123
-
125
+
124
126
waitBusy ();
125
127
}
126
128
127
129
// -------------------------------------------------------------------
128
130
void DisplayChar_DIP204spi::writeDat ( BYTE dat )
129
131
{
130
132
BYTE data[3 ];
131
-
133
+
132
134
data[0 ] = (0x1F ) // START
133
135
| (1 <<6 ) // RS
134
136
| (0 <<5 ); // RW
0 commit comments