Library to drive DogM16x text displays
Diff: DogM16x.c
- Revision:
- 3:fb071acba88f
- Parent:
- 2:5c2b562c9875
diff -r 5c2b562c9875 -r fb071acba88f DogM16x.c --- a/DogM16x.c Wed Jan 12 21:53:46 2011 +0000 +++ b/DogM16x.c Fri Jan 28 07:31:58 2011 +0000 @@ -87,7 +87,7 @@ */ void DogM16x::Clear() { WriteCommandByte(0x01); - wait_ms(50); + wait_ms(2); _xpos = 0; _ypos = 0; } @@ -112,7 +112,7 @@ } WriteCommandByte(0x80 + line*distance_per_line + x); - + wait_us(27); _xpos = x; _ypos = line; } @@ -124,6 +124,7 @@ void DogM16x::WriteCharacter(char character) { if(_xpos < 16) { WriteDataByte(character); + wait_us(27); _xpos++; } } @@ -143,7 +144,7 @@ * * @param string string */ -void DogM16x::WriteString(char* string) { +void DogM16x::WriteString(const char* string) { _rs = 1; @@ -161,8 +162,34 @@ * @param x x-position (starting with 0) * @param line (LINE_1, LINE_2 or LINE3) */ -void DogM16x::WriteString(char* string, unsigned char x, DogM16x_LINE line) { +void DogM16x::WriteString(const char* string, unsigned char x, DogM16x_LINE line) { SetPosition(x,line); WriteString(string); } +void DogM16x::WriteStringCompleteLine(const char* string, DogM16x_LINE line) +{ + WriteStringCompleteLine(string, 0, line); +} + +void DogM16x::WriteStringCompleteLine(const char* string, unsigned char x, DogM16x_LINE line) +{ + SetPosition(x,line); + _rs = 1; + + while ((string[0] != 0x00)&&(_xpos < 16)) + { + wait_us(30); + SetData(string[0]); + string++; + _xpos++; + } + + while (_xpos < 16) + { + wait_us(30); + SetData(' '); + _xpos++; + } +} +