* Fix dirtying in oled_write_pixel()
Set the dirty bit for the block only if oled_write_pixel() actually
changed the buffer state. Without this check oled_write_pixel() could
not be used inside the oled_task_user() code using the “redraw always”
style, because the blocks touched by oled_write_pixel() would always
appear dirty, and oled_render() would not proceed beyond the first such
dirty block.
* Fix oled_write_pixel() with 90/270 degree rotation
Use oled_rotation_width instead of OLED_DISPLAY_WIDTH, so that a rotated
display would be handled correctly.
* Fix compilation with custom OLED_BLOCK_COUNT and OLED_BLOCK_SIZE
Some OLED sizes (e.g., 64×48) may require a nonstandard value of
OLED_BLOCK_COUNT. The documentation says that this value may be
redefined in config.h, but actually trying to redefine it caused a
compile error, because the macro was redefined in oled_driver.c.
Make the OLED_BLOCK_COUNT definition in oled_driver.c respect any
user override, and do the same for OLED_BLOCK_SIZE just in case.
* Fix handling of out-of-range bits in oled_dirty
If a custom OLED_BLOCK_COUNT value is specified, some bits in oled_dirty
may not correspond to existing blocks; however, if those bits are set
somewhere (e.g., by code with sets oled_dirty to ~0 or even -1),
oled_render() would try to handle them and could access memory beyond
oled_buffer and perform hardware operations with out of range values.
Prevent this by masking off unused bits in oled_render(), and also avoid
setting those bits in other functions.
* Fix potentially wrong dirtying in oled_write_char()
oled_write_char() tried to mark the position just beyond the written
character as dirty; use (OLED_FONT_WIDTH - 1) to dirty the last position
still belonging to the character instead.
* Fix `#define OLED_BLOCK_TYPE uint32_t` on AVR
Using uint32_t as OLED_BLOCK_TYPE did not work properly on AVR, because
some bit shifts were performed using 16-bit int. Add explicit casts to
OLED_BLOCK_TYPE to those shifts.
* I2C_TIMEOUT is not defined on arm teensy
* Work round teensy having different ChibiOS config options
* Stash OLED conf files
* update comment
* update comment
* Remove stm32 alias to allow teensy alt mode
* Add a function to set individual pixels
* Add documentation for oled_write_pixel
* use smaller data type for oled_write_pixel
* Fix boundary check edge case
* Update oled_write_pixel doc
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
* Update tmk_core/common/progmem.h
Co-Authored-By: Ryan <fauxpark@gmail.com>
* Update quantum/rgblight.c
Co-Authored-By: Ryan <fauxpark@gmail.com>
* fixed problem with implicit declaration in quantum/rgblight.c (#8381)
Co-authored-by: Ryan <fauxpark@gmail.com>
* Add buffer based single line pan, arbitrary byte write to buffer
* Change dirty mask to inverse of OLED_BLOCK_TYPE for future proofing larger buffer sizes
* Updating docs to include new functions
* Updating to clarify scroll vs pan
* Fix out of bound OLED font access
The default font is 1344 bytes, or a total of 224 glyphs (each 6-bytes wide).
OLED_FONT_END defaults to 224, which if used will then index off the end of
the font array. So either the documentation or code is wrong.
Instead of figuring out the rewording of the documentation, just change
the OLED_FONT_END default value to 223, to match the documentation and code.
* Add static assert to check array size
Build bomb if the font array size doesn't match to the defines.
Currently OLED Dirver only supports LF (\n) character in a string to clear out the rest of the current line and advance to the next line for writing. This PR adds support for CR (\r) character as well to advance to the next line, however not clear out the rest of the current line. This is extremely useful when you want to display a multi-line logo using a single array without wiping out exiting lines and flagging the OLED as dirty unnecessarily.
* modify oled_driver to support SH1106
also:
- improve mechanism to specify which OLED IC we use
- comment calc_bounds()
- give OLED_COLUMN_OFFSET a default value
- inline comment re: OLED MEMORY_MODE and SH1106
- update docs/feature_oled_driver.h for SH1106 support and related changes
- docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2)
- define out MEMORY_MODE when using SH1106 OLED driver
* document that SSD1306 128x64 on AVR works
Per @XScorpion2: https://github.com/qmk/qmk_firmware/pull/5787#discussion_r291837842