Skip to content

Commit eeec282

Browse files
committed
new timeout
1 parent c304b52 commit eeec282

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Diff for: Src/Hardware/Peripheral/Display/DisplayChar_DIP204spi.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Hw {
2222
//-------------------------------------------------------------------
2323
DisplayChar_DIP204spi::DisplayChar_DIP204spi( SPImaster::Device &spiIn )
2424

25-
: DisplayChar( 0 /* todo ... */, NUM_OF_LINE, NUM_OF_COLUMN ),
25+
: DisplayChar( 0 /* todo ... */, NUM_OF_LINE, NUM_OF_COLUMN ),
2626
spi( spiIn )
2727

2828
{
@@ -44,8 +44,7 @@ void DisplayChar_DIP204spi::gotoTextPos( BYTE lineIn, BYTE columnIn )
4444
// Startadresse fuer Display-Speicher schreiben
4545
if( line < NUM_OF_LINE && column < NUM_OF_COLUMN )
4646
{
47-
// gotoPos, Format: rrrccccc
48-
writeCmd( 0x80 | ((line<<5)+(column&0x1F)) );
47+
writeCmd( 0x80 | ((line&0x07)<<5) | (column&0x1F) );
4948
}
5049
}
5150

@@ -104,31 +103,34 @@ void DisplayChar_DIP204spi::waitBusy( void )
104103
| (1<<5); // RW
105104
data[1] = 0;
106105
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+
}
110112
}
111113

112114
//-------------------------------------------------------------------
113115
void DisplayChar_DIP204spi::writeCmd( BYTE cmd )
114116
{
115117
BYTE data[3];
116-
118+
117119
data[0] = (0x1F) // START
118120
| (0<<6) // RS
119121
| (0<<5); // RW
120122
data[1] = (cmd ) & 0x0F;
121123
data[2] = (cmd>>4) & 0x0F;
122124
spi.transceive( data, 3);
123-
125+
124126
waitBusy();
125127
}
126128

127129
//-------------------------------------------------------------------
128130
void DisplayChar_DIP204spi::writeDat( BYTE dat )
129131
{
130132
BYTE data[3];
131-
133+
132134
data[0] = (0x1F) // START
133135
| (1<<6) // RS
134136
| (0<<5); // RW

0 commit comments

Comments
 (0)