Commit Graph

41 Commits

Author SHA1 Message Date
Tim Crawford
5599c02e83 keymap: Use u8 for array access
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>
2021-08-02 14:37:08 -06:00
Tim Crawford
2a3830fb57 i2c: Use u16 for data length
The length will never be negative.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
99af8a35f5 Use explicitly sized types from stdint
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>
2021-08-02 07:46:44 -06:00
Tim Crawford
701adb2f27 keymap: Define scroll lock
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-19 18:20:49 -06:00
Tim Crawford
4963e04a83 Reindent files using spaces 2021-05-07 12:44:48 -06:00
Tim Crawford
720af4b2b0 Use BIT macro
Mostly done with the cocci script. macro.h was then added manually.
2021-05-07 11:24:25 -06:00
Jeremy Soller
0017450cbb Add LED_SAVE command 2021-03-16 10:33:46 -06:00
Jeremy Soller
2ef4cd7bbd Add matrix command 2021-03-01 11:50:31 -07:00
Ian Douglas Scott
b11bc64bba tool: API and CLI for LED matrix mode 2021-02-26 12:18:02 -07:00
Jeremy Soller
304e7534c9 Add led value and color commands 2021-01-15 08:34:31 -07:00
Jeremy Soller
5bab59a526 Do not duplicate kbled support. Add kbled_max and kbled_get_color functions 2021-01-15 08:34:31 -07:00
Jeremy Soller
4de18eba93 common/macro.h: Add BIT macro 2021-01-05 12:17:16 -07:00
Tim Crawford
5200397bba Fix compilation on AVR
The __reentrant keyword introduced in common code is for SDCC.
2020-10-15 19:25:20 -06:00
Jeremy Soller
fcfdcb88c3 Support international keys on darp6 2020-10-06 09:31:34 -07:00
Fabian Topfstedt
6a081cc1b8 lemp9: Added ISO keyboard layouts (#117)
* LAYOUT_ISO: Conversion of physical ISO layout to keyboard matrix

* fixing interchanged backslash and enter

* default_iso layout added for Clevo L141CU

* fabian layout (ISO, colemak, fn<->ctrl, wide left shift)

* Caps is control

* hardware side: qwerty instead of colemak

* lemp9 fabian: FN+PgUp=Home, FN+PgDn=Eend, FN+LeftShift=KBD_BKL

* lemp9 default_iso: FN+PgUp=Home, FN+PgDn=End

* clevo_l141cu_us_iso.c

* merged

* FN+1=K_FAN_TOGGLE
2020-10-05 14:53:15 -06:00
Jeremy Soller
3b6d262217 Add K_FAN_TOGGLE hotkey 2020-10-05 10:50:11 -07:00
Jeremy Soller
916a6f87f3 Add dynamic keymap config 2020-10-05 09:54:28 -07:00
Jeremy Soller
fc2c3511d2 Move KEYMAP definition to common 2020-10-05 09:54:28 -07:00
Evan Lojewski
b4689cb3f1 i2c: Reduce __data usage by switching i2c routines to use the stack.
By default with the large memory mode, sdcc places temp data in DSEG
(__data) and parameters in XSEG (__xdata). This causes both to be placed
on the stack instead.

Previously, the temperary variables were using up to ox69 bytes in DSEG.
After the change, temperary variables now end at 0x5D (12 bytes less).

The i2c routines were using the following XSEG bytes:
- 0x03 - 0x0b (i2c_recv - 8 bytes now on the stack)
- 0x0c - 0x14 (i2c_send - 8 bytes now on the stack)
- 0x15 - 0x1e (i2c_get - 9 bytes now on the stack)
- 0x1f - 0x2c (i2c_set - 13 bytes now on the stack)
- 0x1e2 - 0x1e5 (i2c_reset - 4 bytes now on the stack)
- 0x1e6 - ? (i2c_start - ? bytes now on the stack)
2020-10-01 10:32:03 -06:00
Jeremy Soller
d0d9f65b6e Use K_ defines for SCI keys 2020-09-29 19:42:05 -06:00
Jeremy Soller
80412e7a10 Rename K_E0 to KF_E0 (key flag E0) to aid in automatic layout generation 2020-09-29 19:42:05 -06:00
Jeremy Soller
de26cdfa74 Commands for reading and setting keyboard map 2020-09-29 19:42:05 -06:00
Tim Crawford
5fd9df0ed0 Add SPDX license identifiers
Add license information to files. Mostly automated with:

    find src/ -name '*.[c,h]' | xargs sed -i '1s,^,// SPDX-License-Identifier: GPL-3.0-only\n\n,'
    find src/ -name '*.mk' | xargs sed -i '1s,^,# SPDX-License-Identifier: GPL-3.0-only\n\n,'
2020-09-17 09:17:08 -06:00
leviport
3c2d1690df Add my layout, enable media next/prev hotkeys, and start doc 2020-06-24 20:14:29 -06:00
Jeremy Soller
62a909ee81 Improve fan curve
- Implement fan cooldown and heatup periods
- Add fan get/set commands
- Fix compilation with logging level lower than debug
2020-04-04 07:30:05 -06:00
Jeremy Soller
8a8ab165a7 Improve print command 2020-03-14 21:06:18 -06:00
Jeremy Soller
68b9acd249 Add ability to flash backup rom 2020-02-26 13:43:31 -07:00
Jeremy Soller
657437e1ce Faster flashing with SMFI (#32)
* WIP: support for new flashing API

* Add SPI flashing support to tool

* Add timeouts when flashing with ectool

* Test SPI reading

* Use chunks for SPI commands

* Sanity test of flash size

* Read rom in sectors

* Relocate memmap region, remove PMC3

* Use ectool to flash

* Remove debugging of spi command

* Fix flashing over smfi
2020-02-26 09:04:40 -07:00
Jeremy Soller
11c15c2291 Implement keyboard backlight on darp5/6 2020-02-21 19:29:59 -07:00
Jeremy Soller
f7453df299 Fix compilation on AVR 2020-02-18 15:35:41 -07:00
Jeremy Soller
81ffcf5ae1 Add version to firmware image 2020-02-16 12:24:02 -07:00
Jeremy Soller
d5f1fb0d5b Implement display switch combo 2020-02-12 14:04:44 -07:00
Jeremy Soller
7dde9dd45e Move SCI extra definitions, add combo definitions 2020-02-12 13:52:47 -07:00
Jeremy Soller
092ae995ce Add camera toggle SCI 2020-01-28 15:05:00 -07:00
Jeremy Soller
144d3e790c Allow common module to compile for AVR 2020-01-16 14:40:45 -07:00
Jeremy Soller
93545fb83c Add support for multiple I2C buses 2020-01-15 16:25:30 -07:00
Jeremy Soller
efa9fb7fb4 Refactor to minimize differences between galp3-c and lemp9 code 2020-01-15 15:54:43 -07:00
Jeremy Soller
8c90323b6a Add ARRAY_SIZE 2019-11-20 10:47:10 -07:00
Jeremy Soller
93e35d2cc5 Add debug levels 2019-11-18 09:22:21 -07:00
Jeremy Soller
890d8e9968 Move i2c support to common 2019-11-13 14:33:04 -07:00
Jeremy Soller
15004f76b3 Set console baud to 1 MHz 2019-09-30 17:36:15 -06:00