Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Don't get your hopes too high! This is an early draft PR for the lesson/features discussed in #42. Currently this PR includes only the "core" serial implementation (or what I'm calling
SioCore
), the code is not integrated with any existing code and there is no way to demo/test it.The code here is a much refined version of my some experimental code and I'm relatively happy with it. (and to make sure I stay happy with it, I'm sticking it right here, as it is and I'm going to press the big green button). So please have a look, ask questions, etc. but I understand that in this state there's not necessarily a lot to respond to. To be clear: it is working code, but it doesn't do anything on its own.
A few questions and things I'm not sure of:
SioTick
repeatedly will work. For the tutorial, it may be preferred to simply call the tick routine once per frame?About the design/impl/code:
SioCore is kind of a multi-byte version of the underlying GB serial API. The core implements the clock provider's synchronisation delay and timeouts for the externally clocked device.
Configure a transfer by setting the data in/out locations (via the pointers
wSioTxPtr
,wSioRxPtr
) and the number of bytes to transfer (wSioCount
). Call theSioTick
routine repeatedly until all the transfers are complete (wSioCount == 0
).Packet (not here yet) transfers a small chunk of data at a time. Builds directly on top of Core. Data transmission errors are managed here. A checksum is used to detect errors. Each packet can be retransmitted a limited number of time should an error be detected. The cost of retransmission is limited by the small packet size.
Bulk (not here yet) is more of a role/responsibility than a
Thing
. It's the thing responsible for splitting bulk data into packets and orchestrating their transfer. It's the interface between the high score code and the serial code.Handshake (not here yet) establishes the connection -- as much as you can call it that. Establishes which device is the clock, provides initial detection of a connected device and a simple check to identify compatible software/protocol. This sounds like a lot (having written it down), but it amounts to sending a handful of magic numbers and expecting a specific sequence in return.