Commit Graph

12 Commits

Author SHA1 Message Date
Sylvain Munaut 5a98883e03 firmware/main: Fix SPI Xfer and always read the byte from HW
Without that the SPI_SR_RRDY bit isn't cleared for the next
transfer.

It uses to works simply because the PicoRV32 wasn't fast enough ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-23 07:38:52 +01:00
Sylvain Munaut 4eb2ed52d2 firmware/main: For candle mode, make max brightness random
This makes it look a bit smoother and also reduces the average
current, saving a bit of power.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-20 15:26:13 +01:00
Sylvain Munaut 2277549293 firmware/main: For breathe mode, allow earlier OverBright re-use
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-20 15:20:07 +01:00
Sylvain Munaut 69d8da7f2a firmware/main: Add the new animation led code
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-19 19:47:39 +01:00
Sylvain Munaut 4da1f456ad firmware/main: Use "lightness" terminology
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-19 19:41:05 +01:00
Sylvain Munaut a14030f4a4 firmware/main: Cleanup pass on the led control code
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-16 20:22:46 +01:00
Sylvain Munaut 84470dd095 firmware/main: Rework main loop skeleton
Basically if VBUS is present, we enable USB and we don't go to
sleep to make sure we react in time.

Also add skeleton to read and handle button press events.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-16 10:07:57 +01:00
Sylvain Munaut ebc8a810c7 firmware: Move rand16() to utils.{c,h}
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-16 09:59:06 +01:00
Sylvain Munaut 27f35141de gateware/firmware: Add better support for buttons
The press events are detected in the gateware and latched
and the firmware can just read them as "events". They also
trigger sys clock domain wake up if it was sleeping.

This is better since the 'sys' clock domain can be shutdown for
some non-negligible amount of time and it could lead to missed
presses or latency.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-16 09:59:06 +01:00
Sylvain Munaut acaef093d4 firmware: Add .gitignore
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-12 11:07:12 +01:00
Sylvain Munaut bbd3486f8c firmware: Import the main firmware
This is the state that was used for the battery testing, so
import as-is to keep a record of changes.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-12 11:05:07 +01:00
Sylvain Munaut f4ee67209b firmware: Import of the boot code
This is what gets embedded in the bitstream and loads the
main software from flash.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2023-03-11 23:54:51 +01:00