Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Row Offsets for 16x4 display. #64

Open
domdfcoding opened this issue Aug 21, 2021 · 0 comments
Open

Row Offsets for 16x4 display. #64

domdfcoding opened this issue Aug 21, 2021 · 0 comments

Comments

@domdfcoding
Copy link

Hello,

I am trying to use this library with a 16x4 character display. Looking at the code (snippet below) there are hardcoded offsets for the third and fourth rows, with the third row starting at 0x14 (20) and the fourth at 0x54 (84, 20 addresses along from the start of row 2).

# Offset for up to 4 rows.
_LCD_ROW_OFFSETS = (0x00, 0x40, 0x14, 0x54)

This would make sense for a 20x4 LCD. However, for my particular display, row 3 starts at 0x10 (16) and row 4 at 0x50 (80, 64+16). I imagine this would be the case with almost all displays, with the offsets equal to the number of characters in each row.

I had expected the columns and lines arguments to Character_LCD_Mono to automatically handle the offsets for me. My workaround is to modify the class level _LCD_ROW_OFFSETS at runtime:

import adafruit_character_lcd.character_lcd as characterlcd
characterlcd._LCD_ROW_OFFSETS = (0x00, 0x40, 0x14-4, 0x54-4)

If there a better way to go about this? If not, would it be possible to add proper support? Perhaps the calculated offsets could be exposed as a property that can be changed for screens that work differently?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant