9 Commits

Author SHA1 Message Date
CasualPokePlayer
c5cddc0407
RTC state machine improvements (#3459)
* Try to correct the RTC state machine to only operate on edges

Unsure if all of this is entirely right (haven't ran any tests to confirm behavior here). Fixes RTC within Pokemon games (and maybe other games) due to the added write latch code adding a _readPins call.

* More correct behavior based on testing

* Move this init to align to struct

* Correctly handle rtc output on falling edges rather than raising edges

also correctly handle rtc output in general, even in cases outside of an rtc read cmd
_outputPins needed to be corrected here, it shouldn't be reading gpioBase here...

* Simplify

* More RTC state machine fixes

Separate out command start and command write data processing
Command start processing happens again if the command magic is invalid (note: doesn't apply to the unmapped command 5)
Ensure command data processing loops
Output 1s for commands with no actual output

* Put SIO output in states

* Try to correct light sensor too

* inc state version

* fix reserved names
2025-04-29 22:48:23 -07:00
CasualPokePlayer
8740f3dde1 Narrow these in runtime struct too 2025-04-06 21:20:39 -07:00
CasualPokePlayer
3ae429fd91 Implement GPIO internal write latch
Regardless of direction, a write to GPIO data actually succeeds fully with all 4 bits. However, this does not directly touch the pin state. It instead places it into an internal write only latch. This latch asserts bits onto the pin state if direction allows for such, otherwise the other side (e.g. RTC) will be the one asserting bits (but this does not end up touching the internal write latch).

The implementation here is likely not entirely accurate for direction changes from out to in (as that depends on each external device implementation), but it should be correct for in to out changes.
2025-04-06 21:20:39 -07:00
Vicki Pfau
edaa27796b GBA: Improve reset behavior of various hardware components 2024-12-11 17:24:22 -08:00
Vicki Pfau
318c5d7435 GBA: Move GBAHardwareDevice to public API 2024-03-25 01:24:50 -07:00
Vicki Pfau
bb711d311f GBA Savedata: Store RTC data in savegames (closes #240) 2022-10-06 02:57:26 -07:00
Vicki Pfau
cb0af1b77b GBA: Remove obsolete RTC API 2022-01-15 15:29:40 -08:00
Vicki Pfau
23b5a458b8 GBA e-Reader: Refactor out of GPIO code 2021-04-03 13:37:29 -07:00
Vicki Pfau
bc16a1bfe3 GBA Cart: Refactor hardware.c into cart/gpio.c etc 2021-04-03 01:31:55 -07:00