Commit Graph

25 Commits (b5f425b2759283b55a3d4bc1178d82be9304b530)

Author SHA1 Message Date
Sergey Vlasov 459ccb681f
OLED driver fixes (#10377)
* 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.
2020-10-04 05:44:19 +11:00
Fred Silberberg c23667608c
Add OLED driver function to determine if the screen is currently on (#10382) 2020-09-21 18:39:50 -07:00
QMK Bot a3db72df72 format code according to conventions [skip ci] 2020-08-29 22:57:48 +00:00
Richard fa6cf85727 Add a method to read the OLED display buffer from user space (#8777)
* Adding extern and declaration

* Change to mediated buffer read

* Adding raw byte read

* Restore write raw... D'Oh

* Working struct return

* Pack that struct

* Remove conditional packing and add example to docs

* Cleanup tab/spaces

* Update docs/feature_oled_driver.md

Prettify formatting

* Update drivers/oled/oled_driver.h

Prettify formatting
2020-08-29 14:30:02 -07:00
Joel Challis d91987ab9a
Enable OLED support for Teensy 3.2/LC (#7591)
* 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
2020-07-26 07:50:56 +10:00
Gautham Yerroju 92d0a71af7
OLED driver function to set pixels (#9713)
* 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>
2020-07-16 15:48:04 +10:00
Brian Mock 8ca4ed9a98
Fix off by one error with oled_write_raw_P (#9045) 2020-05-10 04:14:07 +01:00
Casper Weiss Bang 13fff52f6b
fixed problem with implicit declaration in quantum/rgblight.c (#8406)
* 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>
2020-03-28 23:35:11 +00:00
QMK Bot 60b020acab format code according to conventions [skip ci] 2020-03-14 21:37:29 +00:00
brickbots b5be96f8bb
Adding OLED scroll setup functions (#8386)
* Adding scroll setup functions:

* Clarifying values stored in oled_scroll_speed
2020-03-14 21:04:34 +00:00
QMK Bot 2306c974e5 format code according to conventions [skip ci] 2020-03-07 01:24:47 +00:00
brickbots 833c5ae87a
Buffer based OLED panning, write byte to buffer at arbitrary index (#8055)
* 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
2020-03-07 00:52:39 +00:00
Ryan c9e3fa6f70
Clean up includes for glcdfont headers (#7745)
* Clean up includes for glcdfont headers

* Remove pragma once, most of these are not headers

* Missed these
2020-03-01 17:56:50 +11:00
Ted M Lin 9456832a3b
Fix out of bound OLED font access (#8145)
* 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.
2020-02-11 21:38:20 +00:00
zvecr 9aedb620c5 Add backwards compatibility for oled_write_raw_P on ARM 2019-12-24 20:13:27 -08:00
Thomas Baart be6562a223 Adds raw write functions to the OLED driver (#7237)
* Added oled_write_raw and oled_write_raw_P functions to the OLED driver

* Added oled_write_raw method calls to feature_oled_driver.md
2019-11-03 14:34:47 -08:00
Drashna Jaelre 8de164e036
Fix Redefinition of OLED_TIMEOUT (#6628) 2019-08-30 16:55:47 -07:00
skullY b624f32f94 clang-format changes 2019-08-30 15:01:52 -07:00
XScorpion2 957070a6b5 Added OLED Display autoscroll during periods of OLED data inactivity (#6546)
* Added OLED Display autoscroll during periods of OLED data inactivity.

* Fixing compile errors

* Feedback from review
2019-08-25 12:37:55 -07:00
XScorpion2 ec3954577c (OLED) Added support for CR (#6399)
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.
2019-07-27 13:17:18 -07:00
Michael F. Lamb e6a81133dd Add SH1106 OLED support (#5787)
* 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
2019-06-11 15:27:17 -07:00
XScorpion2 09968ba035 Fixing OLED Driver for 128x64 displays (#6085) 2019-06-07 17:02:05 -07:00
Ryan Caltabiano d3268280ef Removed / replaced questionable logos and added licenses file for safe logos 2019-04-20 08:05:10 -07:00
Ryan Caltabiano dd3a813f87 Reducing size of data send in one frame & update Zen rev2 oled usage 2019-04-20 08:05:10 -07:00
Ryan Caltabiano 0a645225b9 OLED Driver Feature 2019-04-20 08:05:10 -07:00