Commit Graph

50 Commits

Author SHA1 Message Date
Ondrej Jirman
5bef4c8832 Update TODO and I2C interface description 2021-08-02 12:13:56 +02:00
Ondrej Jirman
5fd891ecc0 firmware: Guard the timer manipulation macro argument 2021-08-02 11:53:31 +02:00
Samuel Holland
394af632aa firmware: Allow to read/write single registers from a charger
This code uses existing system command functionality. The I2C
registers are placed in front of system command register, to
allow for a single transaction proxied I2C A reads/writes.

Not tested, yet.
2021-08-02 11:52:54 +02:00
Ondrej Jirman
c3272eb4ef firmware: Drop POLL mode from the register definition
Polling mode was supposed to help with broken keyboard matrix, where
some keys are stuck, but this is handled well by the pre-existing code
already, so there's no need for this.
2021-08-02 10:23:42 +02:00
Ondrej Jirman
f7c90f1f74 firmware: Fix compilation issue by moving timer code a bit higher 2021-08-02 10:22:18 +02:00
Samuel Holland
78b438a747 firmware: Rebuild if any source file changes
This catches changes to the stock IVT assembly. Instead of adding that
to the list, use $(wildcard) to be more future-proof.
2021-08-02 10:17:37 +02:00
Samuel Holland
1fd0bac031 firmware: Use REG_SYS macro where appropriate
This shortens a very long line.
2021-08-02 10:17:09 +02:00
Samuel Holland
ce6638eb92 firmware: Remove unused variable 2021-08-02 10:14:24 +02:00
Samuel Holland
bd32b43065 usb-flasher: Update stock firmware's USB product ID
The third batch of review samples was flashed with a different stock
firmware, and advertised a different product ID.
2021-08-02 10:13:13 +02:00
Samuel Holland
bd69a00f7a common: Improve crc8 generation
Start with 0xff instead of 0x00, so the CRC will be nonzero (and length
dependent) for data that is all zeroes.

Remove unnecessary masking, since `crc` is already an 8-bit integer.
2021-08-02 10:13:06 +02:00
Samuel Holland
206b96c1e2 i2c-flasher: Add missing argument to printf 2021-08-02 10:13:01 +02:00
Ondrej Jirman
28ba6fbcfc Update TODO 2021-08-02 10:12:48 +02:00
Ondrej Jirman
3b723583e7 firmware: Make interrupt signal shorter (10us)
This is long enough, comparable to 100kHz I2C speeds.
2021-08-02 10:12:48 +02:00
Ondrej Jirman
2fbc2e057e firmware: Implement scanning block
This allows to disable the keyboard. The firmware will never scan
for keys pressed in this mode, and it will powerdown the MCU most of the
time.
2021-08-02 10:12:48 +02:00
Ondrej Jirman
41418cdc14 firmware: Jump to stock firmware sooner after powerup
Signed-off-by: Ondrej Jirman <megous@megous.com>
2021-08-02 10:12:48 +02:00
Ondrej Jirman
176a2da7e2 firmware: Implement USB enabled/disable control via I2C 2021-08-02 10:05:43 +02:00
Ondrej Jirman
134b4b6a8b firmware: Move more of the USB shutdown control to usb_enable/usb_disable
- make sure USB resources are re-enabled before jumping to bootloader
- make sure all USB resources are disabled prior to jumping to user fw
2021-08-02 10:03:48 +02:00
Ondrej Jirman
cea046008f Increase the default flashing area size to 0x2000
This does two things:
- more reasonable default because stock firmware size is larger than
  the previous default
- it will overwrite 0x3fff with 0xff, so that after flashing stock
  firmware the user firmware is automatically disabled
2021-06-28 15:36:58 +02:00
Ondrej Jirman
6a5fe581b9 Implement flashing over I2C and user/stock firmware support
I2C register layout changed a bit to make various operations easier
to implement in FW and for the user.

Flashing/debugging tools now share more code. Firmware is now more
configurable (it's now possible to compile-out various features).

Self-testing for column-shorts is implemented.

Firmware is optimized for low power consumption.
2021-06-28 15:09:47 +02:00
Ondrej Jirman
201b84d70e Update link to kernel driver 2021-06-20 13:16:55 +02:00
Ondrej Jirman
2a2ce1429c Update the i2c interface spec 2021-06-20 01:48:34 +02:00
Ondrej Jirman
f0b5f8cb68 And another update of the I2C spec 2021-06-19 21:42:52 +02:00
Ondrej Jirman
2185fdaae5 Update I2C spec 2021-06-19 21:23:03 +02:00
Ondrej Jirman
541c1ae17a Add I2C interface specification 2021-06-19 21:15:38 +02:00
Ondrej Jirman
04ca071b09 Fixup/document I2C 2021-06-19 02:51:23 +02:00
Ondrej Jirman
fbfa245ad4 Allow to use debug printing from interrupt handlers 2021-06-19 02:50:34 +02:00
Ondrej Jirman
2725248532 Add USB stack for easier printf() based debugging of the firmware 2021-06-18 19:43:11 +02:00
Ondrej Jirman
f7857f94ab Add the latest binary build of the firmware 2021-06-18 18:31:28 +02:00
Ondrej Jirman
c8d8eef090 Fix key release change detection in polling mode 2021-06-18 18:28:56 +02:00
Ondrej Jirman
93687e1b04 Add flashing help file 2021-06-18 18:26:58 +02:00
Ondrej Jirman
cea3dfb502 Add link to Samuel's kernel driver 2021-06-18 18:20:19 +02:00
Ondrej Jirman
212dea4914 Tidy up the flashing tool 2021-06-18 18:20:16 +02:00
Ondrej Jirman
c1d2adfc96 Update TODO 2021-06-17 11:40:08 +02:00
Ondrej Jirman
a739b4b856 Add reaped URB error checking 2021-06-17 11:16:58 +02:00
Ondrej Jirman
c8736296c3 Update TODO 2021-06-16 18:19:34 +02:00
Ondrej Jirman
a6f823612a Build kmap.h as part of a build process 2021-06-16 17:19:38 +02:00
Ondrej Jirman
dba6fb37c1 Add sticky fn/pine mode (press fn+esc or pine+esc to enter, esc to exit it)
In sticky mode, fn or pine key acts as stuck.
2021-06-16 17:02:02 +02:00
Ondrej Jirman
ff7e733636 Disable workaround for my broken prototype by default 2021-06-16 16:49:51 +02:00
Ondrej Jirman
a2ff7e6e98 Add uinput daemon that creates an input device for the keyboard 2021-06-16 16:47:59 +02:00
Ondrej Jirman
b9b02a5e73 Update some comments 2021-06-16 14:44:18 +02:00
Ondrej Jirman
2e29c24145 Add HACKING file 2021-06-16 14:32:28 +02:00
Ondrej Jirman
bca8c47f46 Implement polled mode and key bitmap change signalling via external interrupt
- this firmware consumes about 4-5 mA (can be probably made lower)
2021-06-16 14:09:25 +02:00
Ondrej Jirman
a9bb6a3691 Add a tool to convert keymap description to a header file 2021-06-15 09:23:10 +02:00
Ondrej Jirman
736018ce82 Fix factory keymap 2021-06-15 09:22:47 +02:00
Ondrej Jirman
a8c9398567 Allow to exit from bootloader mode without flasing
Useful for when you hit PINE+FN+F and don't want to flash a firmware.

./kbprog-usb reset
2021-06-15 09:22:31 +02:00
Ondrej Jirman
e59f647d83 Allow to switch to bootloader mode via FN+PINE+F 2021-06-15 09:21:31 +02:00
Ondrej Jirman
8a6af7acf7 Add tool for communicating with the charger 2021-06-15 09:20:43 +02:00
Ondrej Jirman
717cfd6526 Add keymaps 2021-06-14 13:31:54 +02:00
Ondrej Jirman
8250f31e2b Add links to video/blog/donations 2021-06-14 00:16:19 +02:00
Ondrej Jirman
d3c45f58a4 Initial commit 2021-06-14 00:10:49 +02:00