picocomputer / rp6502

Picocomputer 6502 firmware
BSD 3-Clause "New" or "Revised" License
85 stars 23 forks source link

API real time clock #14

Closed rumbledethumps closed 7 months ago

rumbledethumps commented 1 year ago

The Pi Pico has a RTC but no battery. Just like many classic 8-bit machines. Create an API and connect it to FatFs get_fattime() too.

brentward commented 1 year ago

I'm going to take a crack at this one.

rumbledethumps commented 1 year ago

Some notes... Use the develop branch. Change FF_FS_NORTC in ffconf.h. Make a new device driver: api/rtc.c. Add driver to main.c events. Pi Pico API is called hardware_rtc.

rumbledethumps commented 1 year ago

As an exercise in testing my own stuff, I used the new helpers to build a shim for time.h. This has not been tested except for the failure path it takes now. https://github.com/picocomputer/rp6502-sdk/blob/7c9cb84e850aa8d4f68174005c350e3a54ecd865/src/clock.c