π Let's explore Closures in #Ruby with a space-themed example! π #ThomasTip
Closures are functions/methods that can be invoked from other functions or methods, while retaining access to variables from their original scope.
What we're looking at here is the first initialization instructions being sent from MicroPython (uPy) running on Raspberry Pi Pico (RPi Pico) through a PCF8574 8-bit I/O expander via I2C, to an HD44780 controlling a "1602" Dot Matrix LCD.π§΅
I reached the Twitter thread limit with this rabbit hole. It wasn't going anywhere in particular, so I appreciate you coming for the ride.
If you've ever written drivers, I'd love to hear about your experience! I have no idea what I'm doing π
https://t.co/pJWoglPL4u
What we're looking at here is the first initialization instructions being sent from MicroPython (uPy) running on Raspberry Pi Pico (RPi Pico) through a PCF8574 8-bit I/O expander via I2C, to an HD44780 controlling a "1602" Dot Matrix LCD.π§΅
So what is PB4 doing with data length?
Setting it to 1, as we've done, tells the HD44780 that we're sending and receiving data in 8-bit lengths. Confusingly, we're sending in 4-bit lengths, but during initialization, we must use 8-bit mode and allow PB0-PB3 to be considered 0.