You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

796 lines
24 KiB

2021 May 29 Breaking Changes Update (#13034) * Add Per Key functionality for AutoShift (#11536) * LED Matrix: Reactive effect buffers & advanced indicators (#12588) * [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626) * [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625) * LED Matrix: Split (#12633) * [CI] Format code according to conventions (#12650) * feat: infinite timeout for leader key (#6580) * feat: implement leader_no_timeout logic * docs(leader_key): infinite leader timeout docs * Format code according to conventions (#12680) * Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403) * Fix default ADC_RESOLUTION for ADCv3 (and ADCv4) Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers (that macro should not have been there, because ADCv3 has CFGR instead of CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS if it is defined (that name is used for ADCv3 and ADCv4). * Update ADC docs to match the actually used resolution ADC driver for ChibiOS actually uses the 10-bit resolution by default (probably to match AVR); fix the documentation accordingly. Also add both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names differ according to the ADC implementation in the particular MCU). * Fix pinToMux() for B12 and B13 on STM32F3xx Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and B13 pins were wrong. * Add support for all possible analog pins on STM32F1xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx (they are the same at least for STM32F103x8 and larger F103 devices, and also F102, F105, F107 families). Actually tested on STM32F103C8T6 (therefore pins C0...C5 were not tested). Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages, cannot be supported at the moment, because those pins are connected only to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1. * Add support for all possible analog pins on STM32F4xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are apparently the same for all F4xx devices, except some smaller devices may not have ADC3. Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested. Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices which don't have ADC3 also don't have the GPIOF port, therefore the code which refers to Fx pins does not compile. * Fix STM32F3xx ADC mux table in documentation The ADC driver documentation had some errors in the mux table for STM32F3xx. Fix this table to match the datasheet and the actual code (mux settings for B12 and B13 were also tested on a real STM32F303CCT6 chip). * Add STM32F1xx ADC pins to the documentation * Add STM32F4xx ADC pins to the documentation * Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600) * Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example. * Update flashing.md * Update chconf.h * Update config.h * Update halconf.h * Update mcuconf.h * eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671) * Add support for MCU = STM32F446 (#12619) * Add support for MCU = STM32F446 * Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h * Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64 * stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled. * Format code according to conventions (#12682) * Format code according to conventions (#12687) * Add STM32L433 and L443 support (#12063) * initial L433 commit * change to XC * fix L433 * disable all peripherals * update system and peripheral clocks * 433 change * use its own board files * revert its own board files * l433 specific change * fix stm32l432xx define * remove duplicate #define * fix bootloader jump * move to L443xx and add i2c2, spi2, usart3 to mcuconf.h * move to L443 * move to L443 * fix sdmmc in mcuconf.h * include STM32L443 * add L443 * Include L443 in compatible microcontrollers * Include L443 in compatible microcontrollers * Update config bootloader jump description * Update ChibiOS define reasoning * Update quantum/mcu_selection.mk * fix git conflict * Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613) * Fix bad PR merge for #6580. (#12721) * Change RGB/LED Matrix to use a simple define for USB suspend (#12697) * [CI] Format code according to conventions (#12731) * Fixing transport's led/rgb matrix suspend state logic (#12770) * [CI] Format code according to conventions (#12772) * Fix comment parsing (#12750) * Added OLED fade out support (#12086) * fix some references to bin/qmk that slipped in (#12832) * Resolve a number of warnings in `qmk generate-api` (#12833) * New command: qmk console (#12828) * stash poc * stash * tidy up implementation * Tidy up slightly for review * Tidy up slightly for review * Bodge environment to make tests pass * Refactor away from asyncio due to windows issues * Filter devices * align vid/pid printing * Add hidapi to the installers * start preparing for multiple hid_listeners * udev rules for hid_listen * refactor to move closer to end state * very basic implementation of the threaded model * refactor how vid/pid/index are supplied and parsed * windows improvements * read the report directly when usage page isn't available * add per-device colors, the choice to show names or numbers, and refactor * add timestamps * Add support for showing bootloaders * tweak the color for bootloaders * Align bootloader disconnect with connect color * add support for showing all bootloaders * fix the pyusb check * tweaks * fix exception * hide a stack trace behind -v * add --no-bootloaders option * add documentation for qmk console * Apply suggestions from code review * pyformat * clean up and flesh out KNOWN_BOOTLOADERS * Remove pointless SERIAL_LINK_ENABLE rules (#12846) * Make Swap Hands use PROGMEM (#12284) This converts the array that the Swap Hands feature uses to use PROGMEM, and to read from that array, as such. Since this array never changes at runtime, there is no reason to keep it in memory. Especially for AVR boards, as memory is a precious resource. * Fix another bin/qmk reference (#12856) * [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419) * Fixup build errors on `develop` branch. (#12723) * LED Matrix: Effects! (#12651) * Fix syntax error when compiling for ARM (#12866) * Remove KEYMAP and LAYOUT_kc (#12160) * alias KEYMAP to LAYOUT * remove KEYMAP and LAYOUT_kc * Add setup, clone, and env to the list of commands we allow even with broken modules (#12868) * Rename `point_t` -> `led_point_t` (#12864) * [Keyboard] updated a vendor name / fixed minor keymap issues (#12881) * Add missing LED Matrix suspend code to suspend.c (#12878) * LED Matrix: Documentation (#12685) * Deprecate `send_unicode_hex_string()` (#12602) * Fix spelling mistake regarding LED Matrix in split_common. (#12888) * [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895) * Use milc.subcommand.config instead of qmk.cli.config (#12915) * Use milc.subcommand.config instead * pyformat * remove the config test * Add function to allow repeated blinking of one layer (#12237) * Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time * Update doc * Rework rgblight blinking according to requested change * optimize storage * Fixup housekeeping from being invoked twice per loop. (#12933) * matrix: wait for row signal to go HIGH for every row (#12945) I noticed this discrepancy (last row of the matrix treated differently than the others) when optimizing the input latency of my keyboard controller, see also https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/ Before this commit, when tuning the delays I noticed ghost key presses when pressing the F2 key, which is on the last row of the keyboard matrix: the dead_grave key, which is on the first row of the keyboard matrix, would be incorrectly detected as pressed. After this commit, all keyboard matrix rows are interpreted correctly. I suspect that my setup is more susceptible to this nuance than others because I use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask the problem. * ensure we do not conflict with existing keymap aliases (#12976) * Add support for up to 4 IS31FL3733 drivers (#12342) * Convert Encoder callbacks to be boolean functions (#12805) * [Keyboard] Fix Terrazzo build failure (#12977) * Do not hard set config in CPTC files (#11864) * [Keyboard] Corne - Remove legacy revision support (#12226) * [Keymap] Update to Drashna keymap and user code (based on develop) (#12936) * Add Full-duplex serial driver for ARM boards (#9842) * Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987) * Backlight: add defines for default level and breathing state (#12560) * Add dire message about LUFA mass storage bootloader (#13014) * [Keyboard] Remove redundant legacy and common headers for crkbd (#13023) Was causing compiler errors on some systems. * Fix keyboards/keymaps for boolean encoder callback changes (#12985) * `backlight.c`: include `eeprom.h` (#13024) * Add changelog for 2021-05-29 Breaking Changes merge (#12939) * Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version * Add recent develop changes * Sort recent develop changes * Remove sections for ChibiOS changes per tzarc No ChibiOS changes this round. * Add and sort recent develop changes * add notes about keyboard moves/deletions * import changelog for PR 12172 Documents the change to BOOTMAGIC_ENABLE. * update section headings * re-sort changelog * add additional note regarding Bootmagic changes * remove changelog timestamp * update dates in main Breaking Changes docs * fix broken section anchors in previous changelogs * add link to backlight/eeprom patch to changelog * highlight some more changes * link PRs from section headers * Restore standard readme * run: qmk cformat --core-only
3 years ago
2021 May 29 Breaking Changes Update (#13034) * Add Per Key functionality for AutoShift (#11536) * LED Matrix: Reactive effect buffers & advanced indicators (#12588) * [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626) * [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625) * LED Matrix: Split (#12633) * [CI] Format code according to conventions (#12650) * feat: infinite timeout for leader key (#6580) * feat: implement leader_no_timeout logic * docs(leader_key): infinite leader timeout docs * Format code according to conventions (#12680) * Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403) * Fix default ADC_RESOLUTION for ADCv3 (and ADCv4) Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers (that macro should not have been there, because ADCv3 has CFGR instead of CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS if it is defined (that name is used for ADCv3 and ADCv4). * Update ADC docs to match the actually used resolution ADC driver for ChibiOS actually uses the 10-bit resolution by default (probably to match AVR); fix the documentation accordingly. Also add both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names differ according to the ADC implementation in the particular MCU). * Fix pinToMux() for B12 and B13 on STM32F3xx Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and B13 pins were wrong. * Add support for all possible analog pins on STM32F1xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx (they are the same at least for STM32F103x8 and larger F103 devices, and also F102, F105, F107 families). Actually tested on STM32F103C8T6 (therefore pins C0...C5 were not tested). Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages, cannot be supported at the moment, because those pins are connected only to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1. * Add support for all possible analog pins on STM32F4xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are apparently the same for all F4xx devices, except some smaller devices may not have ADC3. Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested. Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices which don't have ADC3 also don't have the GPIOF port, therefore the code which refers to Fx pins does not compile. * Fix STM32F3xx ADC mux table in documentation The ADC driver documentation had some errors in the mux table for STM32F3xx. Fix this table to match the datasheet and the actual code (mux settings for B12 and B13 were also tested on a real STM32F303CCT6 chip). * Add STM32F1xx ADC pins to the documentation * Add STM32F4xx ADC pins to the documentation * Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600) * Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example. * Update flashing.md * Update chconf.h * Update config.h * Update halconf.h * Update mcuconf.h * eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671) * Add support for MCU = STM32F446 (#12619) * Add support for MCU = STM32F446 * Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h * Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64 * stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled. * Format code according to conventions (#12682) * Format code according to conventions (#12687) * Add STM32L433 and L443 support (#12063) * initial L433 commit * change to XC * fix L433 * disable all peripherals * update system and peripheral clocks * 433 change * use its own board files * revert its own board files * l433 specific change * fix stm32l432xx define * remove duplicate #define * fix bootloader jump * move to L443xx and add i2c2, spi2, usart3 to mcuconf.h * move to L443 * move to L443 * fix sdmmc in mcuconf.h * include STM32L443 * add L443 * Include L443 in compatible microcontrollers * Include L443 in compatible microcontrollers * Update config bootloader jump description * Update ChibiOS define reasoning * Update quantum/mcu_selection.mk * fix git conflict * Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613) * Fix bad PR merge for #6580. (#12721) * Change RGB/LED Matrix to use a simple define for USB suspend (#12697) * [CI] Format code according to conventions (#12731) * Fixing transport's led/rgb matrix suspend state logic (#12770) * [CI] Format code according to conventions (#12772) * Fix comment parsing (#12750) * Added OLED fade out support (#12086) * fix some references to bin/qmk that slipped in (#12832) * Resolve a number of warnings in `qmk generate-api` (#12833) * New command: qmk console (#12828) * stash poc * stash * tidy up implementation * Tidy up slightly for review * Tidy up slightly for review * Bodge environment to make tests pass * Refactor away from asyncio due to windows issues * Filter devices * align vid/pid printing * Add hidapi to the installers * start preparing for multiple hid_listeners * udev rules for hid_listen * refactor to move closer to end state * very basic implementation of the threaded model * refactor how vid/pid/index are supplied and parsed * windows improvements * read the report directly when usage page isn't available * add per-device colors, the choice to show names or numbers, and refactor * add timestamps * Add support for showing bootloaders * tweak the color for bootloaders * Align bootloader disconnect with connect color * add support for showing all bootloaders * fix the pyusb check * tweaks * fix exception * hide a stack trace behind -v * add --no-bootloaders option * add documentation for qmk console * Apply suggestions from code review * pyformat * clean up and flesh out KNOWN_BOOTLOADERS * Remove pointless SERIAL_LINK_ENABLE rules (#12846) * Make Swap Hands use PROGMEM (#12284) This converts the array that the Swap Hands feature uses to use PROGMEM, and to read from that array, as such. Since this array never changes at runtime, there is no reason to keep it in memory. Especially for AVR boards, as memory is a precious resource. * Fix another bin/qmk reference (#12856) * [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419) * Fixup build errors on `develop` branch. (#12723) * LED Matrix: Effects! (#12651) * Fix syntax error when compiling for ARM (#12866) * Remove KEYMAP and LAYOUT_kc (#12160) * alias KEYMAP to LAYOUT * remove KEYMAP and LAYOUT_kc * Add setup, clone, and env to the list of commands we allow even with broken modules (#12868) * Rename `point_t` -> `led_point_t` (#12864) * [Keyboard] updated a vendor name / fixed minor keymap issues (#12881) * Add missing LED Matrix suspend code to suspend.c (#12878) * LED Matrix: Documentation (#12685) * Deprecate `send_unicode_hex_string()` (#12602) * Fix spelling mistake regarding LED Matrix in split_common. (#12888) * [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895) * Use milc.subcommand.config instead of qmk.cli.config (#12915) * Use milc.subcommand.config instead * pyformat * remove the config test * Add function to allow repeated blinking of one layer (#12237) * Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time * Update doc * Rework rgblight blinking according to requested change * optimize storage * Fixup housekeeping from being invoked twice per loop. (#12933) * matrix: wait for row signal to go HIGH for every row (#12945) I noticed this discrepancy (last row of the matrix treated differently than the others) when optimizing the input latency of my keyboard controller, see also https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/ Before this commit, when tuning the delays I noticed ghost key presses when pressing the F2 key, which is on the last row of the keyboard matrix: the dead_grave key, which is on the first row of the keyboard matrix, would be incorrectly detected as pressed. After this commit, all keyboard matrix rows are interpreted correctly. I suspect that my setup is more susceptible to this nuance than others because I use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask the problem. * ensure we do not conflict with existing keymap aliases (#12976) * Add support for up to 4 IS31FL3733 drivers (#12342) * Convert Encoder callbacks to be boolean functions (#12805) * [Keyboard] Fix Terrazzo build failure (#12977) * Do not hard set config in CPTC files (#11864) * [Keyboard] Corne - Remove legacy revision support (#12226) * [Keymap] Update to Drashna keymap and user code (based on develop) (#12936) * Add Full-duplex serial driver for ARM boards (#9842) * Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987) * Backlight: add defines for default level and breathing state (#12560) * Add dire message about LUFA mass storage bootloader (#13014) * [Keyboard] Remove redundant legacy and common headers for crkbd (#13023) Was causing compiler errors on some systems. * Fix keyboards/keymaps for boolean encoder callback changes (#12985) * `backlight.c`: include `eeprom.h` (#13024) * Add changelog for 2021-05-29 Breaking Changes merge (#12939) * Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version * Add recent develop changes * Sort recent develop changes * Remove sections for ChibiOS changes per tzarc No ChibiOS changes this round. * Add and sort recent develop changes * add notes about keyboard moves/deletions * import changelog for PR 12172 Documents the change to BOOTMAGIC_ENABLE. * update section headings * re-sort changelog * add additional note regarding Bootmagic changes * remove changelog timestamp * update dates in main Breaking Changes docs * fix broken section anchors in previous changelogs * add link to backlight/eeprom patch to changelog * highlight some more changes * link PRs from section headers * Restore standard readme * run: qmk cformat --core-only
3 years ago
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.
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
2021 May 29 Breaking Changes Update (#13034) * Add Per Key functionality for AutoShift (#11536) * LED Matrix: Reactive effect buffers & advanced indicators (#12588) * [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626) * [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625) * LED Matrix: Split (#12633) * [CI] Format code according to conventions (#12650) * feat: infinite timeout for leader key (#6580) * feat: implement leader_no_timeout logic * docs(leader_key): infinite leader timeout docs * Format code according to conventions (#12680) * Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403) * Fix default ADC_RESOLUTION for ADCv3 (and ADCv4) Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers (that macro should not have been there, because ADCv3 has CFGR instead of CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS if it is defined (that name is used for ADCv3 and ADCv4). * Update ADC docs to match the actually used resolution ADC driver for ChibiOS actually uses the 10-bit resolution by default (probably to match AVR); fix the documentation accordingly. Also add both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names differ according to the ADC implementation in the particular MCU). * Fix pinToMux() for B12 and B13 on STM32F3xx Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and B13 pins were wrong. * Add support for all possible analog pins on STM32F1xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx (they are the same at least for STM32F103x8 and larger F103 devices, and also F102, F105, F107 families). Actually tested on STM32F103C8T6 (therefore pins C0...C5 were not tested). Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages, cannot be supported at the moment, because those pins are connected only to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1. * Add support for all possible analog pins on STM32F4xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are apparently the same for all F4xx devices, except some smaller devices may not have ADC3. Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested. Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices which don't have ADC3 also don't have the GPIOF port, therefore the code which refers to Fx pins does not compile. * Fix STM32F3xx ADC mux table in documentation The ADC driver documentation had some errors in the mux table for STM32F3xx. Fix this table to match the datasheet and the actual code (mux settings for B12 and B13 were also tested on a real STM32F303CCT6 chip). * Add STM32F1xx ADC pins to the documentation * Add STM32F4xx ADC pins to the documentation * Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600) * Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example. * Update flashing.md * Update chconf.h * Update config.h * Update halconf.h * Update mcuconf.h * eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671) * Add support for MCU = STM32F446 (#12619) * Add support for MCU = STM32F446 * Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h * Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64 * stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled. * Format code according to conventions (#12682) * Format code according to conventions (#12687) * Add STM32L433 and L443 support (#12063) * initial L433 commit * change to XC * fix L433 * disable all peripherals * update system and peripheral clocks * 433 change * use its own board files * revert its own board files * l433 specific change * fix stm32l432xx define * remove duplicate #define * fix bootloader jump * move to L443xx and add i2c2, spi2, usart3 to mcuconf.h * move to L443 * move to L443 * fix sdmmc in mcuconf.h * include STM32L443 * add L443 * Include L443 in compatible microcontrollers * Include L443 in compatible microcontrollers * Update config bootloader jump description * Update ChibiOS define reasoning * Update quantum/mcu_selection.mk * fix git conflict * Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613) * Fix bad PR merge for #6580. (#12721) * Change RGB/LED Matrix to use a simple define for USB suspend (#12697) * [CI] Format code according to conventions (#12731) * Fixing transport's led/rgb matrix suspend state logic (#12770) * [CI] Format code according to conventions (#12772) * Fix comment parsing (#12750) * Added OLED fade out support (#12086) * fix some references to bin/qmk that slipped in (#12832) * Resolve a number of warnings in `qmk generate-api` (#12833) * New command: qmk console (#12828) * stash poc * stash * tidy up implementation * Tidy up slightly for review * Tidy up slightly for review * Bodge environment to make tests pass * Refactor away from asyncio due to windows issues * Filter devices * align vid/pid printing * Add hidapi to the installers * start preparing for multiple hid_listeners * udev rules for hid_listen * refactor to move closer to end state * very basic implementation of the threaded model * refactor how vid/pid/index are supplied and parsed * windows improvements * read the report directly when usage page isn't available * add per-device colors, the choice to show names or numbers, and refactor * add timestamps * Add support for showing bootloaders * tweak the color for bootloaders * Align bootloader disconnect with connect color * add support for showing all bootloaders * fix the pyusb check * tweaks * fix exception * hide a stack trace behind -v * add --no-bootloaders option * add documentation for qmk console * Apply suggestions from code review * pyformat * clean up and flesh out KNOWN_BOOTLOADERS * Remove pointless SERIAL_LINK_ENABLE rules (#12846) * Make Swap Hands use PROGMEM (#12284) This converts the array that the Swap Hands feature uses to use PROGMEM, and to read from that array, as such. Since this array never changes at runtime, there is no reason to keep it in memory. Especially for AVR boards, as memory is a precious resource. * Fix another bin/qmk reference (#12856) * [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419) * Fixup build errors on `develop` branch. (#12723) * LED Matrix: Effects! (#12651) * Fix syntax error when compiling for ARM (#12866) * Remove KEYMAP and LAYOUT_kc (#12160) * alias KEYMAP to LAYOUT * remove KEYMAP and LAYOUT_kc * Add setup, clone, and env to the list of commands we allow even with broken modules (#12868) * Rename `point_t` -> `led_point_t` (#12864) * [Keyboard] updated a vendor name / fixed minor keymap issues (#12881) * Add missing LED Matrix suspend code to suspend.c (#12878) * LED Matrix: Documentation (#12685) * Deprecate `send_unicode_hex_string()` (#12602) * Fix spelling mistake regarding LED Matrix in split_common. (#12888) * [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895) * Use milc.subcommand.config instead of qmk.cli.config (#12915) * Use milc.subcommand.config instead * pyformat * remove the config test * Add function to allow repeated blinking of one layer (#12237) * Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time * Update doc * Rework rgblight blinking according to requested change * optimize storage * Fixup housekeeping from being invoked twice per loop. (#12933) * matrix: wait for row signal to go HIGH for every row (#12945) I noticed this discrepancy (last row of the matrix treated differently than the others) when optimizing the input latency of my keyboard controller, see also https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/ Before this commit, when tuning the delays I noticed ghost key presses when pressing the F2 key, which is on the last row of the keyboard matrix: the dead_grave key, which is on the first row of the keyboard matrix, would be incorrectly detected as pressed. After this commit, all keyboard matrix rows are interpreted correctly. I suspect that my setup is more susceptible to this nuance than others because I use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask the problem. * ensure we do not conflict with existing keymap aliases (#12976) * Add support for up to 4 IS31FL3733 drivers (#12342) * Convert Encoder callbacks to be boolean functions (#12805) * [Keyboard] Fix Terrazzo build failure (#12977) * Do not hard set config in CPTC files (#11864) * [Keyboard] Corne - Remove legacy revision support (#12226) * [Keymap] Update to Drashna keymap and user code (based on develop) (#12936) * Add Full-duplex serial driver for ARM boards (#9842) * Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987) * Backlight: add defines for default level and breathing state (#12560) * Add dire message about LUFA mass storage bootloader (#13014) * [Keyboard] Remove redundant legacy and common headers for crkbd (#13023) Was causing compiler errors on some systems. * Fix keyboards/keymaps for boolean encoder callback changes (#12985) * `backlight.c`: include `eeprom.h` (#13024) * Add changelog for 2021-05-29 Breaking Changes merge (#12939) * Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version * Add recent develop changes * Sort recent develop changes * Remove sections for ChibiOS changes per tzarc No ChibiOS changes this round. * Add and sort recent develop changes * add notes about keyboard moves/deletions * import changelog for PR 12172 Documents the change to BOOTMAGIC_ENABLE. * update section headings * re-sort changelog * add additional note regarding Bootmagic changes * remove changelog timestamp * update dates in main Breaking Changes docs * fix broken section anchors in previous changelogs * add link to backlight/eeprom patch to changelog * highlight some more changes * link PRs from section headers * Restore standard readme * run: qmk cformat --core-only
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
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.
3 years ago
2021 May 29 Breaking Changes Update (#13034) * Add Per Key functionality for AutoShift (#11536) * LED Matrix: Reactive effect buffers & advanced indicators (#12588) * [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626) * [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625) * LED Matrix: Split (#12633) * [CI] Format code according to conventions (#12650) * feat: infinite timeout for leader key (#6580) * feat: implement leader_no_timeout logic * docs(leader_key): infinite leader timeout docs * Format code according to conventions (#12680) * Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403) * Fix default ADC_RESOLUTION for ADCv3 (and ADCv4) Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers (that macro should not have been there, because ADCv3 has CFGR instead of CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS if it is defined (that name is used for ADCv3 and ADCv4). * Update ADC docs to match the actually used resolution ADC driver for ChibiOS actually uses the 10-bit resolution by default (probably to match AVR); fix the documentation accordingly. Also add both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names differ according to the ADC implementation in the particular MCU). * Fix pinToMux() for B12 and B13 on STM32F3xx Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and B13 pins were wrong. * Add support for all possible analog pins on STM32F1xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx (they are the same at least for STM32F103x8 and larger F103 devices, and also F102, F105, F107 families). Actually tested on STM32F103C8T6 (therefore pins C0...C5 were not tested). Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages, cannot be supported at the moment, because those pins are connected only to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1. * Add support for all possible analog pins on STM32F4xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are apparently the same for all F4xx devices, except some smaller devices may not have ADC3. Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested. Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices which don't have ADC3 also don't have the GPIOF port, therefore the code which refers to Fx pins does not compile. * Fix STM32F3xx ADC mux table in documentation The ADC driver documentation had some errors in the mux table for STM32F3xx. Fix this table to match the datasheet and the actual code (mux settings for B12 and B13 were also tested on a real STM32F303CCT6 chip). * Add STM32F1xx ADC pins to the documentation * Add STM32F4xx ADC pins to the documentation * Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600) * Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example. * Update flashing.md * Update chconf.h * Update config.h * Update halconf.h * Update mcuconf.h * eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671) * Add support for MCU = STM32F446 (#12619) * Add support for MCU = STM32F446 * Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h * Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64 * stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled. * Format code according to conventions (#12682) * Format code according to conventions (#12687) * Add STM32L433 and L443 support (#12063) * initial L433 commit * change to XC * fix L433 * disable all peripherals * update system and peripheral clocks * 433 change * use its own board files * revert its own board files * l433 specific change * fix stm32l432xx define * remove duplicate #define * fix bootloader jump * move to L443xx and add i2c2, spi2, usart3 to mcuconf.h * move to L443 * move to L443 * fix sdmmc in mcuconf.h * include STM32L443 * add L443 * Include L443 in compatible microcontrollers * Include L443 in compatible microcontrollers * Update config bootloader jump description * Update ChibiOS define reasoning * Update quantum/mcu_selection.mk * fix git conflict * Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613) * Fix bad PR merge for #6580. (#12721) * Change RGB/LED Matrix to use a simple define for USB suspend (#12697) * [CI] Format code according to conventions (#12731) * Fixing transport's led/rgb matrix suspend state logic (#12770) * [CI] Format code according to conventions (#12772) * Fix comment parsing (#12750) * Added OLED fade out support (#12086) * fix some references to bin/qmk that slipped in (#12832) * Resolve a number of warnings in `qmk generate-api` (#12833) * New command: qmk console (#12828) * stash poc * stash * tidy up implementation * Tidy up slightly for review * Tidy up slightly for review * Bodge environment to make tests pass * Refactor away from asyncio due to windows issues * Filter devices * align vid/pid printing * Add hidapi to the installers * start preparing for multiple hid_listeners * udev rules for hid_listen * refactor to move closer to end state * very basic implementation of the threaded model * refactor how vid/pid/index are supplied and parsed * windows improvements * read the report directly when usage page isn't available * add per-device colors, the choice to show names or numbers, and refactor * add timestamps * Add support for showing bootloaders * tweak the color for bootloaders * Align bootloader disconnect with connect color * add support for showing all bootloaders * fix the pyusb check * tweaks * fix exception * hide a stack trace behind -v * add --no-bootloaders option * add documentation for qmk console * Apply suggestions from code review * pyformat * clean up and flesh out KNOWN_BOOTLOADERS * Remove pointless SERIAL_LINK_ENABLE rules (#12846) * Make Swap Hands use PROGMEM (#12284) This converts the array that the Swap Hands feature uses to use PROGMEM, and to read from that array, as such. Since this array never changes at runtime, there is no reason to keep it in memory. Especially for AVR boards, as memory is a precious resource. * Fix another bin/qmk reference (#12856) * [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419) * Fixup build errors on `develop` branch. (#12723) * LED Matrix: Effects! (#12651) * Fix syntax error when compiling for ARM (#12866) * Remove KEYMAP and LAYOUT_kc (#12160) * alias KEYMAP to LAYOUT * remove KEYMAP and LAYOUT_kc * Add setup, clone, and env to the list of commands we allow even with broken modules (#12868) * Rename `point_t` -> `led_point_t` (#12864) * [Keyboard] updated a vendor name / fixed minor keymap issues (#12881) * Add missing LED Matrix suspend code to suspend.c (#12878) * LED Matrix: Documentation (#12685) * Deprecate `send_unicode_hex_string()` (#12602) * Fix spelling mistake regarding LED Matrix in split_common. (#12888) * [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895) * Use milc.subcommand.config instead of qmk.cli.config (#12915) * Use milc.subcommand.config instead * pyformat * remove the config test * Add function to allow repeated blinking of one layer (#12237) * Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time * Update doc * Rework rgblight blinking according to requested change * optimize storage * Fixup housekeeping from being invoked twice per loop. (#12933) * matrix: wait for row signal to go HIGH for every row (#12945) I noticed this discrepancy (last row of the matrix treated differently than the others) when optimizing the input latency of my keyboard controller, see also https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/ Before this commit, when tuning the delays I noticed ghost key presses when pressing the F2 key, which is on the last row of the keyboard matrix: the dead_grave key, which is on the first row of the keyboard matrix, would be incorrectly detected as pressed. After this commit, all keyboard matrix rows are interpreted correctly. I suspect that my setup is more susceptible to this nuance than others because I use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask the problem. * ensure we do not conflict with existing keymap aliases (#12976) * Add support for up to 4 IS31FL3733 drivers (#12342) * Convert Encoder callbacks to be boolean functions (#12805) * [Keyboard] Fix Terrazzo build failure (#12977) * Do not hard set config in CPTC files (#11864) * [Keyboard] Corne - Remove legacy revision support (#12226) * [Keymap] Update to Drashna keymap and user code (based on develop) (#12936) * Add Full-duplex serial driver for ARM boards (#9842) * Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987) * Backlight: add defines for default level and breathing state (#12560) * Add dire message about LUFA mass storage bootloader (#13014) * [Keyboard] Remove redundant legacy and common headers for crkbd (#13023) Was causing compiler errors on some systems. * Fix keyboards/keymaps for boolean encoder callback changes (#12985) * `backlight.c`: include `eeprom.h` (#13024) * Add changelog for 2021-05-29 Breaking Changes merge (#12939) * Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version * Add recent develop changes * Sort recent develop changes * Remove sections for ChibiOS changes per tzarc No ChibiOS changes this round. * Add and sort recent develop changes * add notes about keyboard moves/deletions * import changelog for PR 12172 Documents the change to BOOTMAGIC_ENABLE. * update section headings * re-sort changelog * add additional note regarding Bootmagic changes * remove changelog timestamp * update dates in main Breaking Changes docs * fix broken section anchors in previous changelogs * add link to backlight/eeprom patch to changelog * highlight some more changes * link PRs from section headers * Restore standard readme * run: qmk cformat --core-only
3 years ago
2021 May 29 Breaking Changes Update (#13034) * Add Per Key functionality for AutoShift (#11536) * LED Matrix: Reactive effect buffers & advanced indicators (#12588) * [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626) * [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625) * LED Matrix: Split (#12633) * [CI] Format code according to conventions (#12650) * feat: infinite timeout for leader key (#6580) * feat: implement leader_no_timeout logic * docs(leader_key): infinite leader timeout docs * Format code according to conventions (#12680) * Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403) * Fix default ADC_RESOLUTION for ADCv3 (and ADCv4) Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers (that macro should not have been there, because ADCv3 has CFGR instead of CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS if it is defined (that name is used for ADCv3 and ADCv4). * Update ADC docs to match the actually used resolution ADC driver for ChibiOS actually uses the 10-bit resolution by default (probably to match AVR); fix the documentation accordingly. Also add both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names differ according to the ADC implementation in the particular MCU). * Fix pinToMux() for B12 and B13 on STM32F3xx Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and B13 pins were wrong. * Add support for all possible analog pins on STM32F1xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx (they are the same at least for STM32F103x8 and larger F103 devices, and also F102, F105, F107 families). Actually tested on STM32F103C8T6 (therefore pins C0...C5 were not tested). Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages, cannot be supported at the moment, because those pins are connected only to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1. * Add support for all possible analog pins on STM32F4xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are apparently the same for all F4xx devices, except some smaller devices may not have ADC3. Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested. Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices which don't have ADC3 also don't have the GPIOF port, therefore the code which refers to Fx pins does not compile. * Fix STM32F3xx ADC mux table in documentation The ADC driver documentation had some errors in the mux table for STM32F3xx. Fix this table to match the datasheet and the actual code (mux settings for B12 and B13 were also tested on a real STM32F303CCT6 chip). * Add STM32F1xx ADC pins to the documentation * Add STM32F4xx ADC pins to the documentation * Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600) * Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example. * Update flashing.md * Update chconf.h * Update config.h * Update halconf.h * Update mcuconf.h * eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671) * Add support for MCU = STM32F446 (#12619) * Add support for MCU = STM32F446 * Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h * Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64 * stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled. * Format code according to conventions (#12682) * Format code according to conventions (#12687) * Add STM32L433 and L443 support (#12063) * initial L433 commit * change to XC * fix L433 * disable all peripherals * update system and peripheral clocks * 433 change * use its own board files * revert its own board files * l433 specific change * fix stm32l432xx define * remove duplicate #define * fix bootloader jump * move to L443xx and add i2c2, spi2, usart3 to mcuconf.h * move to L443 * move to L443 * fix sdmmc in mcuconf.h * include STM32L443 * add L443 * Include L443 in compatible microcontrollers * Include L443 in compatible microcontrollers * Update config bootloader jump description * Update ChibiOS define reasoning * Update quantum/mcu_selection.mk * fix git conflict * Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613) * Fix bad PR merge for #6580. (#12721) * Change RGB/LED Matrix to use a simple define for USB suspend (#12697) * [CI] Format code according to conventions (#12731) * Fixing transport's led/rgb matrix suspend state logic (#12770) * [CI] Format code according to conventions (#12772) * Fix comment parsing (#12750) * Added OLED fade out support (#12086) * fix some references to bin/qmk that slipped in (#12832) * Resolve a number of warnings in `qmk generate-api` (#12833) * New command: qmk console (#12828) * stash poc * stash * tidy up implementation * Tidy up slightly for review * Tidy up slightly for review * Bodge environment to make tests pass * Refactor away from asyncio due to windows issues * Filter devices * align vid/pid printing * Add hidapi to the installers * start preparing for multiple hid_listeners * udev rules for hid_listen * refactor to move closer to end state * very basic implementation of the threaded model * refactor how vid/pid/index are supplied and parsed * windows improvements * read the report directly when usage page isn't available * add per-device colors, the choice to show names or numbers, and refactor * add timestamps * Add support for showing bootloaders * tweak the color for bootloaders * Align bootloader disconnect with connect color * add support for showing all bootloaders * fix the pyusb check * tweaks * fix exception * hide a stack trace behind -v * add --no-bootloaders option * add documentation for qmk console * Apply suggestions from code review * pyformat * clean up and flesh out KNOWN_BOOTLOADERS * Remove pointless SERIAL_LINK_ENABLE rules (#12846) * Make Swap Hands use PROGMEM (#12284) This converts the array that the Swap Hands feature uses to use PROGMEM, and to read from that array, as such. Since this array never changes at runtime, there is no reason to keep it in memory. Especially for AVR boards, as memory is a precious resource. * Fix another bin/qmk reference (#12856) * [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419) * Fixup build errors on `develop` branch. (#12723) * LED Matrix: Effects! (#12651) * Fix syntax error when compiling for ARM (#12866) * Remove KEYMAP and LAYOUT_kc (#12160) * alias KEYMAP to LAYOUT * remove KEYMAP and LAYOUT_kc * Add setup, clone, and env to the list of commands we allow even with broken modules (#12868) * Rename `point_t` -> `led_point_t` (#12864) * [Keyboard] updated a vendor name / fixed minor keymap issues (#12881) * Add missing LED Matrix suspend code to suspend.c (#12878) * LED Matrix: Documentation (#12685) * Deprecate `send_unicode_hex_string()` (#12602) * Fix spelling mistake regarding LED Matrix in split_common. (#12888) * [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895) * Use milc.subcommand.config instead of qmk.cli.config (#12915) * Use milc.subcommand.config instead * pyformat * remove the config test * Add function to allow repeated blinking of one layer (#12237) * Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time * Update doc * Rework rgblight blinking according to requested change * optimize storage * Fixup housekeeping from being invoked twice per loop. (#12933) * matrix: wait for row signal to go HIGH for every row (#12945) I noticed this discrepancy (last row of the matrix treated differently than the others) when optimizing the input latency of my keyboard controller, see also https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/ Before this commit, when tuning the delays I noticed ghost key presses when pressing the F2 key, which is on the last row of the keyboard matrix: the dead_grave key, which is on the first row of the keyboard matrix, would be incorrectly detected as pressed. After this commit, all keyboard matrix rows are interpreted correctly. I suspect that my setup is more susceptible to this nuance than others because I use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask the problem. * ensure we do not conflict with existing keymap aliases (#12976) * Add support for up to 4 IS31FL3733 drivers (#12342) * Convert Encoder callbacks to be boolean functions (#12805) * [Keyboard] Fix Terrazzo build failure (#12977) * Do not hard set config in CPTC files (#11864) * [Keyboard] Corne - Remove legacy revision support (#12226) * [Keymap] Update to Drashna keymap and user code (based on develop) (#12936) * Add Full-duplex serial driver for ARM boards (#9842) * Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987) * Backlight: add defines for default level and breathing state (#12560) * Add dire message about LUFA mass storage bootloader (#13014) * [Keyboard] Remove redundant legacy and common headers for crkbd (#13023) Was causing compiler errors on some systems. * Fix keyboards/keymaps for boolean encoder callback changes (#12985) * `backlight.c`: include `eeprom.h` (#13024) * Add changelog for 2021-05-29 Breaking Changes merge (#12939) * Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version * Add recent develop changes * Sort recent develop changes * Remove sections for ChibiOS changes per tzarc No ChibiOS changes this round. * Add and sort recent develop changes * add notes about keyboard moves/deletions * import changelog for PR 12172 Documents the change to BOOTMAGIC_ENABLE. * update section headings * re-sort changelog * add additional note regarding Bootmagic changes * remove changelog timestamp * update dates in main Breaking Changes docs * fix broken section anchors in previous changelogs * add link to backlight/eeprom patch to changelog * highlight some more changes * link PRs from section headers * Restore standard readme * run: qmk cformat --core-only
3 years ago
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.
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
  1. /*
  2. Copyright 2019 Ryan Caltabiano <https://github.com/XScorpion2>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include "i2c_master.h"
  15. #include "oled_driver.h"
  16. #include OLED_FONT_H
  17. #include "timer.h"
  18. #include "print.h"
  19. #include <string.h>
  20. #include "progmem.h"
  21. #include "keyboard.h"
  22. // Used commands from spec sheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
  23. // for SH1106: https://www.velleman.eu/downloads/29/infosheets/sh1106_datasheet.pdf
  24. // Fundamental Commands
  25. #define CONTRAST 0x81
  26. #define DISPLAY_ALL_ON 0xA5
  27. #define DISPLAY_ALL_ON_RESUME 0xA4
  28. #define NORMAL_DISPLAY 0xA6
  29. #define INVERT_DISPLAY 0xA7
  30. #define DISPLAY_ON 0xAF
  31. #define DISPLAY_OFF 0xAE
  32. #define NOP 0xE3
  33. // Scrolling Commands
  34. #define ACTIVATE_SCROLL 0x2F
  35. #define DEACTIVATE_SCROLL 0x2E
  36. #define SCROLL_RIGHT 0x26
  37. #define SCROLL_LEFT 0x27
  38. #define SCROLL_RIGHT_UP 0x29
  39. #define SCROLL_LEFT_UP 0x2A
  40. // Addressing Setting Commands
  41. #define MEMORY_MODE 0x20
  42. #define COLUMN_ADDR 0x21
  43. #define PAGE_ADDR 0x22
  44. #define PAM_SETCOLUMN_LSB 0x00
  45. #define PAM_SETCOLUMN_MSB 0x10
  46. #define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
  47. // Hardware Configuration Commands
  48. #define DISPLAY_START_LINE 0x40
  49. #define SEGMENT_REMAP 0xA0
  50. #define SEGMENT_REMAP_INV 0xA1
  51. #define MULTIPLEX_RATIO 0xA8
  52. #define COM_SCAN_INC 0xC0
  53. #define COM_SCAN_DEC 0xC8
  54. #define DISPLAY_OFFSET 0xD3
  55. #define COM_PINS 0xDA
  56. #define COM_PINS_SEQ 0x02
  57. #define COM_PINS_ALT 0x12
  58. #define COM_PINS_SEQ_LR 0x22
  59. #define COM_PINS_ALT_LR 0x32
  60. // Timing & Driving Commands
  61. #define DISPLAY_CLOCK 0xD5
  62. #define PRE_CHARGE_PERIOD 0xD9
  63. #define VCOM_DETECT 0xDB
  64. // Advance Graphic Commands
  65. #define FADE_BLINK 0x23
  66. #define ENABLE_FADE 0x20
  67. #define ENABLE_BLINK 0x30
  68. // Charge Pump Commands
  69. #define CHARGE_PUMP 0x8D
  70. // Misc defines
  71. #ifndef OLED_BLOCK_COUNT
  72. # define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8)
  73. #endif
  74. #ifndef OLED_BLOCK_SIZE
  75. # define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)
  76. #endif
  77. #define OLED_ALL_BLOCKS_MASK (((((OLED_BLOCK_TYPE)1 << (OLED_BLOCK_COUNT - 1)) - 1) << 1) | 1)
  78. // i2c defines
  79. #define I2C_CMD 0x00
  80. #define I2C_DATA 0x40
  81. #if defined(__AVR__)
  82. # define I2C_TRANSMIT_P(data) i2c_transmit_P((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
  83. #else // defined(__AVR__)
  84. # define I2C_TRANSMIT_P(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
  85. #endif // defined(__AVR__)
  86. #define I2C_TRANSMIT(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
  87. #define I2C_WRITE_REG(mode, data, size) i2c_writeReg((OLED_DISPLAY_ADDRESS << 1), mode, data, size, OLED_I2C_TIMEOUT)
  88. #define HAS_FLAGS(bits, flags) ((bits & flags) == flags)
  89. // Display buffer's is the same as the OLED memory layout
  90. // this is so we don't end up with rounding errors with
  91. // parts of the display unusable or don't get cleared correctly
  92. // and also allows for drawing & inverting
  93. uint8_t oled_buffer[OLED_MATRIX_SIZE];
  94. uint8_t * oled_cursor;
  95. OLED_BLOCK_TYPE oled_dirty = 0;
  96. bool oled_initialized = false;
  97. bool oled_active = false;
  98. bool oled_scrolling = false;
  99. bool oled_inverted = false;
  100. uint8_t oled_brightness = OLED_BRIGHTNESS;
  101. oled_rotation_t oled_rotation = 0;
  102. uint8_t oled_rotation_width = 0;
  103. uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values
  104. uint8_t oled_scroll_start = 0;
  105. uint8_t oled_scroll_end = 7;
  106. #if OLED_TIMEOUT > 0
  107. uint32_t oled_timeout;
  108. #endif
  109. #if OLED_SCROLL_TIMEOUT > 0
  110. uint32_t oled_scroll_timeout;
  111. #endif
  112. #if OLED_UPDATE_INTERVAL > 0
  113. uint16_t oled_update_timeout;
  114. #endif
  115. // Internal variables to reduce math instructions
  116. #if defined(__AVR__)
  117. // identical to i2c_transmit, but for PROGMEM since all initialization is in PROGMEM arrays currently
  118. // probably should move this into i2c_master...
  119. static i2c_status_t i2c_transmit_P(uint8_t address, const uint8_t *data, uint16_t length, uint16_t timeout) {
  120. i2c_status_t status = i2c_start(address | I2C_WRITE, timeout);
  121. for (uint16_t i = 0; i < length && status >= 0; i++) {
  122. status = i2c_write(pgm_read_byte((const char *)data++), timeout);
  123. if (status) break;
  124. }
  125. i2c_stop();
  126. return status;
  127. }
  128. #endif
  129. // Flips the rendering bits for a character at the current cursor position
  130. static void InvertCharacter(uint8_t *cursor) {
  131. const uint8_t *end = cursor + OLED_FONT_WIDTH;
  132. while (cursor < end) {
  133. *cursor = ~(*cursor);
  134. cursor++;
  135. }
  136. }
  137. bool oled_init(oled_rotation_t rotation) {
  138. #if defined(USE_I2C) && defined(SPLIT_KEYBOARD)
  139. if (!is_keyboard_master()) {
  140. return true;
  141. }
  142. #endif
  143. oled_rotation = oled_init_user(oled_init_kb(rotation));
  144. if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
  145. oled_rotation_width = OLED_DISPLAY_WIDTH;
  146. } else {
  147. oled_rotation_width = OLED_DISPLAY_HEIGHT;
  148. }
  149. i2c_init();
  150. static const uint8_t PROGMEM display_setup1[] = {
  151. I2C_CMD,
  152. DISPLAY_OFF,
  153. DISPLAY_CLOCK,
  154. 0x80,
  155. MULTIPLEX_RATIO,
  156. OLED_DISPLAY_HEIGHT - 1,
  157. DISPLAY_OFFSET,
  158. 0x00,
  159. DISPLAY_START_LINE | 0x00,
  160. CHARGE_PUMP,
  161. 0x14,
  162. #if (OLED_IC != OLED_IC_SH1106)
  163. // MEMORY_MODE is unsupported on SH1106 (Page Addressing only)
  164. MEMORY_MODE,
  165. 0x00, // Horizontal addressing mode
  166. #endif
  167. };
  168. if (I2C_TRANSMIT_P(display_setup1) != I2C_STATUS_SUCCESS) {
  169. print("oled_init cmd set 1 failed\n");
  170. return false;
  171. }
  172. if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_180)) {
  173. static const uint8_t PROGMEM display_normal[] = {I2C_CMD, SEGMENT_REMAP_INV, COM_SCAN_DEC};
  174. if (I2C_TRANSMIT_P(display_normal) != I2C_STATUS_SUCCESS) {
  175. print("oled_init cmd normal rotation failed\n");
  176. return false;
  177. }
  178. } else {
  179. static const uint8_t PROGMEM display_flipped[] = {I2C_CMD, SEGMENT_REMAP, COM_SCAN_INC};
  180. if (I2C_TRANSMIT_P(display_flipped) != I2C_STATUS_SUCCESS) {
  181. print("display_flipped failed\n");
  182. return false;
  183. }
  184. }
  185. static const uint8_t PROGMEM display_setup2[] = {I2C_CMD, COM_PINS, OLED_COM_PINS, CONTRAST, OLED_BRIGHTNESS, PRE_CHARGE_PERIOD, 0xF1, VCOM_DETECT, 0x20, DISPLAY_ALL_ON_RESUME, NORMAL_DISPLAY, DEACTIVATE_SCROLL, DISPLAY_ON};
  186. if (I2C_TRANSMIT_P(display_setup2) != I2C_STATUS_SUCCESS) {
  187. print("display_setup2 failed\n");
  188. return false;
  189. }
  190. #if OLED_TIMEOUT > 0
  191. oled_timeout = timer_read32() + OLED_TIMEOUT;
  192. #endif
  193. #if OLED_SCROLL_TIMEOUT > 0
  194. oled_scroll_timeout = timer_read32() + OLED_SCROLL_TIMEOUT;
  195. #endif
  196. oled_clear();
  197. oled_initialized = true;
  198. oled_active = true;
  199. oled_scrolling = false;
  200. return true;
  201. }
  202. __attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
  203. return rotation;
  204. }
  205. __attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) {
  206. return rotation;
  207. }
  208. void oled_clear(void) {
  209. memset(oled_buffer, 0, sizeof(oled_buffer));
  210. oled_cursor = &oled_buffer[0];
  211. oled_dirty = OLED_ALL_BLOCKS_MASK;
  212. }
  213. static void calc_bounds(uint8_t update_start, uint8_t *cmd_array) {
  214. // Calculate commands to set memory addressing bounds.
  215. uint8_t start_page = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_WIDTH;
  216. uint8_t start_column = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_WIDTH;
  217. #if (OLED_IC == OLED_IC_SH1106)
  218. // Commands for Page Addressing Mode. Sets starting page and column; has no end bound.
  219. // Column value must be split into high and low nybble and sent as two commands.
  220. cmd_array[0] = PAM_PAGE_ADDR | start_page;
  221. cmd_array[1] = PAM_SETCOLUMN_LSB | ((OLED_COLUMN_OFFSET + start_column) & 0x0f);
  222. cmd_array[2] = PAM_SETCOLUMN_MSB | ((OLED_COLUMN_OFFSET + start_column) >> 4 & 0x0f);
  223. cmd_array[3] = NOP;
  224. cmd_array[4] = NOP;
  225. cmd_array[5] = NOP;
  226. #else
  227. // Commands for use in Horizontal Addressing mode.
  228. cmd_array[1] = start_column;
  229. cmd_array[4] = start_page;
  230. cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) % OLED_DISPLAY_WIDTH + cmd_array[1];
  231. cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) / OLED_DISPLAY_WIDTH - 1;
  232. #endif
  233. }
  234. static void calc_bounds_90(uint8_t update_start, uint8_t *cmd_array) {
  235. cmd_array[1] = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_HEIGHT * 8;
  236. cmd_array[4] = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_HEIGHT;
  237. cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8 - 1 + cmd_array[1];
  238. ;
  239. cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) % OLED_DISPLAY_HEIGHT / 8;
  240. }
  241. uint8_t crot(uint8_t a, int8_t n) {
  242. const uint8_t mask = 0x7;
  243. n &= mask;
  244. return a << n | a >> (-n & mask);
  245. }
  246. static void rotate_90(const uint8_t *src, uint8_t *dest) {
  247. for (uint8_t i = 0, shift = 7; i < 8; ++i, --shift) {
  248. uint8_t selector = (1 << i);
  249. for (uint8_t j = 0; j < 8; ++j) {
  250. dest[i] |= crot(src[j] & selector, shift - (int8_t)j);
  251. }
  252. }
  253. }
  254. void oled_render(void) {
  255. if (!oled_initialized) {
  256. return;
  257. }
  258. // Do we have work to do?
  259. oled_dirty &= OLED_ALL_BLOCKS_MASK;
  260. if (!oled_dirty || oled_scrolling) {
  261. return;
  262. }
  263. // Find first dirty block
  264. uint8_t update_start = 0;
  265. while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) {
  266. ++update_start;
  267. }
  268. // Set column & page position
  269. static uint8_t display_start[] = {I2C_CMD, COLUMN_ADDR, 0, OLED_DISPLAY_WIDTH - 1, PAGE_ADDR, 0, OLED_DISPLAY_HEIGHT / 8 - 1};
  270. if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
  271. calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
  272. } else {
  273. calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
  274. }
  275. // Send column & page position
  276. if (I2C_TRANSMIT(display_start) != I2C_STATUS_SUCCESS) {
  277. print("oled_render offset command failed\n");
  278. return;
  279. }
  280. if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
  281. // Send render data chunk as is
  282. if (I2C_WRITE_REG(I2C_DATA, &oled_buffer[OLED_BLOCK_SIZE * update_start], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) {
  283. print("oled_render data failed\n");
  284. return;
  285. }
  286. } else {
  287. // Rotate the render chunks
  288. const static uint8_t source_map[] = OLED_SOURCE_MAP;
  289. const static uint8_t target_map[] = OLED_TARGET_MAP;
  290. static uint8_t temp_buffer[OLED_BLOCK_SIZE];
  291. memset(temp_buffer, 0, sizeof(temp_buffer));
  292. for (uint8_t i = 0; i < sizeof(source_map); ++i) {
  293. rotate_90(&oled_buffer[OLED_BLOCK_SIZE * update_start + source_map[i]], &temp_buffer[target_map[i]]);
  294. }
  295. // Send render data chunk after rotating
  296. if (I2C_WRITE_REG(I2C_DATA, &temp_buffer[0], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) {
  297. print("oled_render90 data failed\n");
  298. return;
  299. }
  300. }
  301. // Turn on display if it is off
  302. oled_on();
  303. // Clear dirty flag
  304. oled_dirty &= ~((OLED_BLOCK_TYPE)1 << update_start);
  305. }
  306. void oled_set_cursor(uint8_t col, uint8_t line) {
  307. uint16_t index = line * oled_rotation_width + col * OLED_FONT_WIDTH;
  308. // Out of bounds?
  309. if (index >= OLED_MATRIX_SIZE) {
  310. index = 0;
  311. }
  312. oled_cursor = &oled_buffer[index];
  313. }
  314. void oled_advance_page(bool clearPageRemainder) {
  315. uint16_t index = oled_cursor - &oled_buffer[0];
  316. uint8_t remaining = oled_rotation_width - (index % oled_rotation_width);
  317. if (clearPageRemainder) {
  318. // Remaining Char count
  319. remaining = remaining / OLED_FONT_WIDTH;
  320. // Write empty character until next line
  321. while (remaining--)
  322. oled_write_char(' ', false);
  323. } else {
  324. // Next page index out of bounds?
  325. if (index + remaining >= OLED_MATRIX_SIZE) {
  326. index = 0;
  327. remaining = 0;
  328. }
  329. oled_cursor = &oled_buffer[index + remaining];
  330. }
  331. }
  332. void oled_advance_char(void) {
  333. uint16_t nextIndex = oled_cursor - &oled_buffer[0] + OLED_FONT_WIDTH;
  334. uint8_t remainingSpace = oled_rotation_width - (nextIndex % oled_rotation_width);
  335. // Do we have enough space on the current line for the next character
  336. if (remainingSpace < OLED_FONT_WIDTH) {
  337. nextIndex += remainingSpace;
  338. }
  339. // Did we go out of bounds
  340. if (nextIndex >= OLED_MATRIX_SIZE) {
  341. nextIndex = 0;
  342. }
  343. // Update cursor position
  344. oled_cursor = &oled_buffer[nextIndex];
  345. }
  346. // Main handler that writes character data to the display buffer
  347. void oled_write_char(const char data, bool invert) {
  348. // Advance to the next line if newline
  349. if (data == '\n') {
  350. // Old source wrote ' ' until end of line...
  351. oled_advance_page(true);
  352. return;
  353. }
  354. if (data == '\r') {
  355. oled_advance_page(false);
  356. return;
  357. }
  358. // copy the current render buffer to check for dirty after
  359. static uint8_t oled_temp_buffer[OLED_FONT_WIDTH];
  360. memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH);
  361. _Static_assert(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array");
  362. // set the reder buffer data
  363. uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
  364. if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) {
  365. memset(oled_cursor, 0x00, OLED_FONT_WIDTH);
  366. } else {
  367. const uint8_t *glyph = &font[(cast_data - OLED_FONT_START) * OLED_FONT_WIDTH];
  368. memcpy_P(oled_cursor, glyph, OLED_FONT_WIDTH);
  369. }
  370. // Invert if needed
  371. if (invert) {
  372. InvertCharacter(oled_cursor);
  373. }
  374. // Dirty check
  375. if (memcmp(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH)) {
  376. uint16_t index = oled_cursor - &oled_buffer[0];
  377. oled_dirty |= ((OLED_BLOCK_TYPE)1 << (index / OLED_BLOCK_SIZE));
  378. // Edgecase check if the written data spans the 2 chunks
  379. oled_dirty |= ((OLED_BLOCK_TYPE)1 << ((index + OLED_FONT_WIDTH - 1) / OLED_BLOCK_SIZE));
  380. }
  381. // Finally move to the next char
  382. oled_advance_char();
  383. }
  384. void oled_write(const char *data, bool invert) {
  385. const char *end = data + strlen(data);
  386. while (data < end) {
  387. oled_write_char(*data, invert);
  388. data++;
  389. }
  390. }
  391. void oled_write_ln(const char *data, bool invert) {
  392. oled_write(data, invert);
  393. oled_advance_page(true);
  394. }
  395. void oled_pan(bool left) {
  396. uint16_t i = 0;
  397. for (uint16_t y = 0; y < OLED_DISPLAY_HEIGHT / 8; y++) {
  398. if (left) {
  399. for (uint16_t x = 0; x < OLED_DISPLAY_WIDTH - 1; x++) {
  400. i = y * OLED_DISPLAY_WIDTH + x;
  401. oled_buffer[i] = oled_buffer[i + 1];
  402. }
  403. } else {
  404. for (uint16_t x = OLED_DISPLAY_WIDTH - 1; x > 0; x--) {
  405. i = y * OLED_DISPLAY_WIDTH + x;
  406. oled_buffer[i] = oled_buffer[i - 1];
  407. }
  408. }
  409. }
  410. oled_dirty = OLED_ALL_BLOCKS_MASK;
  411. }
  412. oled_buffer_reader_t oled_read_raw(uint16_t start_index) {
  413. if (start_index > OLED_MATRIX_SIZE) start_index = OLED_MATRIX_SIZE;
  414. oled_buffer_reader_t ret_reader;
  415. ret_reader.current_element = &oled_buffer[start_index];
  416. ret_reader.remaining_element_count = OLED_MATRIX_SIZE - start_index;
  417. return ret_reader;
  418. }
  419. void oled_write_raw_byte(const char data, uint16_t index) {
  420. if (index > OLED_MATRIX_SIZE) index = OLED_MATRIX_SIZE;
  421. if (oled_buffer[index] == data) return;
  422. oled_buffer[index] = data;
  423. oled_dirty |= ((OLED_BLOCK_TYPE)1 << (index / OLED_BLOCK_SIZE));
  424. }
  425. void oled_write_raw(const char *data, uint16_t size) {
  426. uint16_t cursor_start_index = oled_cursor - &oled_buffer[0];
  427. if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index;
  428. for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) {
  429. uint8_t c = *data++;
  430. if (oled_buffer[i] == c) continue;
  431. oled_buffer[i] = c;
  432. oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE));
  433. }
  434. }
  435. void oled_write_pixel(uint8_t x, uint8_t y, bool on) {
  436. if (x >= oled_rotation_width) {
  437. return;
  438. }
  439. uint16_t index = x + (y / 8) * oled_rotation_width;
  440. if (index >= OLED_MATRIX_SIZE) {
  441. return;
  442. }
  443. uint8_t data = oled_buffer[index];
  444. if (on) {
  445. data |= (1 << (y % 8));
  446. } else {
  447. data &= ~(1 << (y % 8));
  448. }
  449. if (oled_buffer[index] != data) {
  450. oled_buffer[index] = data;
  451. oled_dirty |= ((OLED_BLOCK_TYPE)1 << (index / OLED_BLOCK_SIZE));
  452. }
  453. }
  454. #if defined(__AVR__)
  455. void oled_write_P(const char *data, bool invert) {
  456. uint8_t c = pgm_read_byte(data);
  457. while (c != 0) {
  458. oled_write_char(c, invert);
  459. c = pgm_read_byte(++data);
  460. }
  461. }
  462. void oled_write_ln_P(const char *data, bool invert) {
  463. oled_write_P(data, invert);
  464. oled_advance_page(true);
  465. }
  466. void oled_write_raw_P(const char *data, uint16_t size) {
  467. uint16_t cursor_start_index = oled_cursor - &oled_buffer[0];
  468. if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index;
  469. for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) {
  470. uint8_t c = pgm_read_byte(data++);
  471. if (oled_buffer[i] == c) continue;
  472. oled_buffer[i] = c;
  473. oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE));
  474. }
  475. }
  476. #endif // defined(__AVR__)
  477. bool oled_on(void) {
  478. if (!oled_initialized) {
  479. return oled_active;
  480. }
  481. #if OLED_TIMEOUT > 0
  482. oled_timeout = timer_read32() + OLED_TIMEOUT;
  483. #endif
  484. static const uint8_t PROGMEM display_on[] =
  485. #ifdef OLED_FADE_OUT
  486. {I2C_CMD, FADE_BLINK, 0x00};
  487. #else
  488. {I2C_CMD, DISPLAY_ON};
  489. #endif
  490. if (!oled_active) {
  491. if (I2C_TRANSMIT_P(display_on) != I2C_STATUS_SUCCESS) {
  492. print("oled_on cmd failed\n");
  493. return oled_active;
  494. }
  495. oled_active = true;
  496. }
  497. return oled_active;
  498. }
  499. bool oled_off(void) {
  500. if (!oled_initialized) {
  501. return !oled_active;
  502. }
  503. static const uint8_t PROGMEM display_off[] =
  504. #ifdef OLED_FADE_OUT
  505. {I2C_CMD, FADE_BLINK, ENABLE_FADE | OLED_FADE_OUT_INTERVAL};
  506. #else
  507. {I2C_CMD, DISPLAY_OFF};
  508. #endif
  509. if (oled_active) {
  510. if (I2C_TRANSMIT_P(display_off) != I2C_STATUS_SUCCESS) {
  511. print("oled_off cmd failed\n");
  512. return oled_active;
  513. }
  514. oled_active = false;
  515. }
  516. return !oled_active;
  517. }
  518. bool is_oled_on(void) {
  519. return oled_active;
  520. }
  521. uint8_t oled_set_brightness(uint8_t level) {
  522. if (!oled_initialized) {
  523. return oled_brightness;
  524. }
  525. uint8_t set_contrast[] = {I2C_CMD, CONTRAST, level};
  526. if (oled_brightness != level) {
  527. if (I2C_TRANSMIT(set_contrast) != I2C_STATUS_SUCCESS) {
  528. print("set_brightness cmd failed\n");
  529. return oled_brightness;
  530. }
  531. oled_brightness = level;
  532. }
  533. return oled_brightness;
  534. }
  535. uint8_t oled_get_brightness(void) {
  536. return oled_brightness;
  537. }
  538. // Set the specific 8 lines rows of the screen to scroll.
  539. // 0 is the default for start, and 7 for end, which is the entire
  540. // height of the screen. For 128x32 screens, rows 4-7 are not used.
  541. void oled_scroll_set_area(uint8_t start_line, uint8_t end_line) {
  542. oled_scroll_start = start_line;
  543. oled_scroll_end = end_line;
  544. }
  545. void oled_scroll_set_speed(uint8_t speed) {
  546. // Sets the speed for scrolling... does not take effect
  547. // until scrolling is either started or restarted
  548. // the ssd1306 supports 8 speeds
  549. // FrameRate2 speed = 7
  550. // FrameRate3 speed = 4
  551. // FrameRate4 speed = 5
  552. // FrameRate5 speed = 0
  553. // FrameRate25 speed = 6
  554. // FrameRate64 speed = 1
  555. // FrameRate128 speed = 2
  556. // FrameRate256 speed = 3
  557. // for ease of use these are remaped here to be in order
  558. static const uint8_t scroll_remap[8] = {7, 4, 5, 0, 6, 1, 2, 3};
  559. oled_scroll_speed = scroll_remap[speed];
  560. }
  561. bool oled_scroll_right(void) {
  562. if (!oled_initialized) {
  563. return oled_scrolling;
  564. }
  565. // Dont enable scrolling if we need to update the display
  566. // This prevents scrolling of bad data from starting the scroll too early after init
  567. if (!oled_dirty && !oled_scrolling) {
  568. uint8_t display_scroll_right[] = {I2C_CMD, SCROLL_RIGHT, 0x00, oled_scroll_start, oled_scroll_speed, oled_scroll_end, 0x00, 0xFF, ACTIVATE_SCROLL};
  569. if (I2C_TRANSMIT(display_scroll_right) != I2C_STATUS_SUCCESS) {
  570. print("oled_scroll_right cmd failed\n");
  571. return oled_scrolling;
  572. }
  573. oled_scrolling = true;
  574. }
  575. return oled_scrolling;
  576. }
  577. bool oled_scroll_left(void) {
  578. if (!oled_initialized) {
  579. return oled_scrolling;
  580. }
  581. // Dont enable scrolling if we need to update the display
  582. // This prevents scrolling of bad data from starting the scroll too early after init
  583. if (!oled_dirty && !oled_scrolling) {
  584. uint8_t display_scroll_left[] = {I2C_CMD, SCROLL_LEFT, 0x00, oled_scroll_start, oled_scroll_speed, oled_scroll_end, 0x00, 0xFF, ACTIVATE_SCROLL};
  585. if (I2C_TRANSMIT(display_scroll_left) != I2C_STATUS_SUCCESS) {
  586. print("oled_scroll_left cmd failed\n");
  587. return oled_scrolling;
  588. }
  589. oled_scrolling = true;
  590. }
  591. return oled_scrolling;
  592. }
  593. bool oled_scroll_off(void) {
  594. if (!oled_initialized) {
  595. return !oled_scrolling;
  596. }
  597. if (oled_scrolling) {
  598. static const uint8_t PROGMEM display_scroll_off[] = {I2C_CMD, DEACTIVATE_SCROLL};
  599. if (I2C_TRANSMIT_P(display_scroll_off) != I2C_STATUS_SUCCESS) {
  600. print("oled_scroll_off cmd failed\n");
  601. return oled_scrolling;
  602. }
  603. oled_scrolling = false;
  604. oled_dirty = OLED_ALL_BLOCKS_MASK;
  605. }
  606. return !oled_scrolling;
  607. }
  608. bool is_oled_scrolling(void) {
  609. return oled_scrolling;
  610. }
  611. bool oled_invert(bool invert) {
  612. if (!oled_initialized) {
  613. return oled_inverted;
  614. }
  615. if (invert && !oled_inverted) {
  616. static const uint8_t PROGMEM display_inverted[] = {I2C_CMD, INVERT_DISPLAY};
  617. if (I2C_TRANSMIT_P(display_inverted) != I2C_STATUS_SUCCESS) {
  618. print("oled_invert cmd failed\n");
  619. return oled_inverted;
  620. }
  621. oled_inverted = true;
  622. } else if (!invert && oled_inverted) {
  623. static const uint8_t PROGMEM display_normal[] = {I2C_CMD, NORMAL_DISPLAY};
  624. if (I2C_TRANSMIT_P(display_normal) != I2C_STATUS_SUCCESS) {
  625. print("oled_invert cmd failed\n");
  626. return oled_inverted;
  627. }
  628. oled_inverted = false;
  629. }
  630. return oled_inverted;
  631. }
  632. uint8_t oled_max_chars(void) {
  633. if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
  634. return OLED_DISPLAY_WIDTH / OLED_FONT_WIDTH;
  635. }
  636. return OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH;
  637. }
  638. uint8_t oled_max_lines(void) {
  639. if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
  640. return OLED_DISPLAY_HEIGHT / OLED_FONT_HEIGHT;
  641. }
  642. return OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT;
  643. }
  644. void oled_task(void) {
  645. if (!oled_initialized) {
  646. return;
  647. }
  648. #if OLED_UPDATE_INTERVAL > 0
  649. if (timer_elapsed(oled_update_timeout) >= OLED_UPDATE_INTERVAL) {
  650. oled_update_timeout = timer_read();
  651. oled_set_cursor(0, 0);
  652. oled_task_kb();
  653. }
  654. #else
  655. oled_set_cursor(0, 0);
  656. oled_task_kb();
  657. #endif
  658. #if OLED_SCROLL_TIMEOUT > 0
  659. if (oled_dirty && oled_scrolling) {
  660. oled_scroll_timeout = timer_read32() + OLED_SCROLL_TIMEOUT;
  661. oled_scroll_off();
  662. }
  663. #endif
  664. // Smart render system, no need to check for dirty
  665. oled_render();
  666. // Display timeout check
  667. #if OLED_TIMEOUT > 0
  668. if (oled_active && timer_expired32(timer_read32(), oled_timeout)) {
  669. oled_off();
  670. }
  671. #endif
  672. #if OLED_SCROLL_TIMEOUT > 0
  673. if (!oled_scrolling && timer_expired32(timer_read32(), oled_scroll_timeout)) {
  674. # ifdef OLED_SCROLL_TIMEOUT_RIGHT
  675. oled_scroll_right();
  676. # else
  677. oled_scroll_left();
  678. # endif
  679. }
  680. #endif
  681. }
  682. __attribute__((weak)) bool oled_task_kb(void) {
  683. return oled_task_user();
  684. }
  685. __attribute__((weak)) bool oled_task_user(void) {
  686. return true;
  687. }