Commit Graph

26 Commits

Author SHA1 Message Date
Ondrej Jirman
c55f0a44d5 firmware: Post-revert fixup 2021-08-05 02:27:39 +02:00
Ondrej Jirman
4e89074513 Revert "firmware: Move more of the USB shutdown control to usb_enable/usb_disable"
This reverts commit 134b4b6a8b.
2021-08-05 00:54:46 +02:00
Ondrej Jirman
f0f49c0fbc Revert "firmware: Implement USB enabled/disable control via I2C"
This reverts commit 176a2da7e2.
2021-08-05 00:54:39 +02:00
Ondrej Jirman
7f1655be83 firmware: Don't trigger stop twice in i2c_a_read 2021-08-05 00:50:43 +02:00
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
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
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
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
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
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
c8d8eef090 Fix key release change detection in polling mode 2021-06-18 18:28:56 +02:00
Ondrej Jirman
b9b02a5e73 Update some comments 2021-06-16 14:44:18 +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
e59f647d83 Allow to switch to bootloader mode via FN+PINE+F 2021-06-15 09:21:31 +02:00
Ondrej Jirman
d3c45f58a4 Initial commit 2021-06-14 00:10:49 +02:00