Use the default mode for reading the keyboard scan matrix when being
used as a keyboard. There should be no perceived change in behavior, but
should make the code easier to understand.
Note: `KSO[17:16]` are configured by `GPCRC` on boards that use them.
They are now set to alternate function to use in KBS mode rather than
GPIO mode, with the pull-up enabled to prevent them from floating when
configured as open-drain.
As part of this change, we now only read the hardware matrix state once
upfront, instead of on every iteration through the loop applying the
logic.
Tested by verifying that typing still works on darp9.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
A single timer is used for debouncing all keys, so there is no reason to
perform any operations if the matrix is being debounced. Just return
early and remove some of the convoluted logic.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Allows increased typing speed while avoiding repeating keys due to
contact bounce and keys being rejected by ghost key detection.
This is the default value for QMK.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Replace the get+set logic with a step function to change the backlight
level for `K_KBD_BKL`.
Keyboards using a DAC have a different set of levels due to the
brightness difference between the keyboards.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Update .clang-format for LLVM 14.0, available on Ubuntu 22.04.
There is still plenty that clang-format sucks at or does wrong, so
either add some more blocks to disable it, or just put up with it.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
In proprietary firmware and QMK, the Break key by itself is always just
Pause. They produce the same scan code, but Ctrl must be held for the OS
to recognize it as Break.
Behavior tested with xev.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Replace bare int types with stdint types. This was done with:
grep -rwl 'int' src/ | xargs sed -i 's/\<int\>/int16_t/g'
grep -rwl 'unsigned long' src/ | xargs sed -i 's/\<unsigned long\>/uint32_t/g'
grep -rwl 'unsigned char' src/ | xargs sed -i 's/\<unsigned char\>/uint8_t/g'
Then reverted for *main(), putchar(), and getchar().
The Arduino declarations for parallel_main() were also corrected to
match their definitions.
SDCC does *not* generate the same code in all instances, due to `int`
being treated different than `short int`.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
- Don't record a ghost key as pressed
- Debouce on ghost release to allow ghosts to settle.
- Reduce debounce time from 20ms to 15ms.
Signed-off-by: Evan Lojewski <github@meklort.com>
* Move configuration for battery into board.mk
* lemp9: remove tcpm code
* Move touchpad to its own module
* Add kbled_reset to all platforms, move items to run on CPU reset to a function
* Add defines for battery and charger address
* Add I2C_0 export to it5570e
* Move common system76 board functions into src/board/system76/common