dhylands / python_lcd

Python based library for talking to character based LCDs.
MIT License
310 stars 119 forks source link

How to add extra commands? #33

Open dsssssssss9 opened 3 years ago

dsssssssss9 commented 3 years ago

HI

novice programmer here so please excuse the stupid question

Looking through the lcd_api.py code i notice there seem to be some command codes that have not had any functions defined to use them ( for example LCD_MOVE_DISP) .

I have tried to define functions to implement these but so far zero success

any advice would be gratefully received - i have read the data sheet for the controller but lack the ability to translate the information contained into working code it seems

regards

J

davehylands commented 3 years ago

Looking at the instructions it looks like the LCD_MOVE command changes what happens when characters are output. I haven't played with these to see how the display reacts, so you'd need to experiment a bit.

You could easily add a command like (untested):

def set_move_mode(self, move_display, move_right):
    move = 0
    if move_display:
        move |= self.LCD_MOVE_DISP
    if move_right:
        move |= self.LCD_MOVE_RIGHT
    self.hal_write_command(self.LCD_MOVE | move)

There are probably additional things required as changing the move mode will have ramifications on how the cursor position needs to be updated.

dsssssssss9 commented 3 years ago

Hi thanks for the reply & hints

bit above my current level ( or lack of ) programming talent so looks like i got a bit of learning / experimentation to come over the next few days?

I am very grateful to you for pointing me in the right direction though!!