@@ -180,15 +180,11 @@ void LiquidCrystal_pcf2119_home()
180180
181181void LiquidCrystal_pcf2119_setCursor (uint8_t col , uint8_t row )
182182{
183- const size_t max_lines = sizeof (_row_offsets ) / sizeof (* _row_offsets );
184- if ( row >= max_lines ) {
185- row = max_lines - 1 ; // we count rows starting w/0
186- }
187- if ( row >= _rows ) {
188- row = _rows - 1 ; // we count rows starting w/0
189- }
183+ // clip to display size, starting w/0
184+ if ( col >= _cols ) col = _cols - 1 ;
185+ if ( row >= _rows ) row = _rows - 1 ;
190186
191- LiquidCrystal_pcf2119_command (LCD_SETDDRAMADDR | ( col + _row_offsets [ row ]) );
187+ LiquidCrystal_pcf2119_command (LCD_SETDDRAMADDR + row * _cols + col );
192188}
193189
194190// Turn the display on/off (quickly)
@@ -289,7 +285,7 @@ void LiquidCrystal_pcf2119_createChar(uint8_t location, uint8_t charmap[]) {
289285
290286static void LiquidCrystal_pcf2119_charset (char charset ) {
291287
292- charset &= 0xe0 ; // convert lower to uppper case
288+ charset &= ~ 0x20 ; // convert lower to uppper case
293289 if ((charset == 'F' ) || (charset == 'S' ))
294290 {
295291 _charset = CHARSET_FLIP ;
@@ -309,15 +305,15 @@ static void LiquidCrystal_pcf2119_charset(char charset) {
309305
310306void LiquidCrystal_pcf2119_command (uint8_t value ) {
311307 // write to command register
312- I2C_write_c (_addr , 0 , value );
308+ I2C_write_reg (_addr , 0 , value );
313309}
314310
315311// write a data byte.
316312size_t LiquidCrystal_pcf2119_data (uint8_t value ) {
317313 // write to data register
318- // return 1 for success (if I2C_write_c returned 0)
314+ // return 1 for success (if I2C_write_reg returned 0)
319315 return (
320- I2C_write_c (_addr , 0x40 , value ) ? 0 : 1
316+ I2C_write_reg (_addr , 0x40 , value ) ? 0 : 1
321317 );
322318}
323319
0 commit comments