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>
Replace use of wildcard with list of source files to include. The `-y`
suffix is added, but has no significance since conditional compilation
has not been added yet.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* common: Add macros for min, max, clamp
Simple macros, with no type checking.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* charger: Limit charger values to max valid value
Use the maximum valid value instead of discarding bits.
Fixes: 6295f60172 ("Fix smart charger values")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* charger/bq24780s: Fix charge current mask
bq24780s uses bit 12 for 4096 a current weight.
Fixes: 6295f60172 ("Fix smart charger values")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* oryp: Reduce charge current to 2A
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* charger/bq24780s: Set RSENSE ratio option
Signed-off-by: Tim Crawford <tcrawford@system76.com>
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>
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)
* 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