Month: October 2014

Using LCD HD44780 on Raspberry Pi – part 2: drivers

lcd_20_tutorial_2If we look at our code from part one we will see that more than half functions are used to communicate between Raspi and lcd. In this tutorial we will separate low level function from user functions and create a driver class. Why ? If we connect later our LCD by i2c we will just add new driver and it will work.

All function used to communicate directly with display will be moved to separate driver class, a GPIO driver class. Such basic function are _write and _write4. But in our case it is not so simple, all around a code we have some GPIO.output(self.PINS[‘E’], 1) lines, like in _send(self) function. We will do something about it, but lets start from small things.

Current CharLCD class will be refereed as user driver or user class, and new one as driver or low level driver.