adafruit / adafruit/Adafruit_CircuitPython_RGB_Display
minor write() optimization
- Dominant language
- Python
- Stars
- 143
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
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().
Contributor guide
No contributing guide indexed for this repository
Research direction
Review the driver's write(), read(), and init() methods, focusing first on how self.dc_pin.value changes for command and data bytes. Verify that data-heavy writes avoid unnecessary pin transitions while command writes still toggle the pin correctly, and confirm the pin ends initialization in the expected state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100