adafruit / Adafruit_CircuitPython_RGB_Display

Drivers for RGB displays for Adafruit CircuitPython.
MIT License
129 stars 52 forks source link

minor write() optimization #94

Open Pachelbel1414 opened 3 years ago

Pachelbel1414 commented 3 years ago

Consider that you will often write data bytes without a command byte, but will almost never write a command byte without data bytes. For example, after setting up the display and issuing commands to set the write window and ram write mode, an application might then simply start continuously writing frames. Or even internally, look at the fill_rectangle() command.

As an optimization, consider leaving self.dc_pin.value = 1 as the default state, and only changing it to 0 and then back to 1 when ever a command byte is being written.

I believe the changes for this would trivial and isolated to the write() and read() methods. And to be extra safe, possibly setting it to 1 at the end of init().