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.
This is an early draft PR for the lesson/features discussed in #42. Currently this PR includes only the core serial implementation (
sio.asm
) and it is not integrated with any other code. There is no included way to build a demo/test here, but you can venture to my gbserial repo where I've been developing/testing this if you like. See comment below for more information on that.A few questions and things I'm not sure of:
About the implementation:
Sio (
sio.asm
) is a kind of multi-byte version of the underlying GB serial API.Buffers are provided for data in and out. Using
SioTransferStart
will transfer the whole buffer. Smaller batches are possible but don't have a nice way to start them.Each byte transfer after the first is started from the serial interrupt.
The clock provider's "catchup delay" is implemented as a simple "sleep" loop executed before every byte transfer. The duration of this can be tuned.
SioTick
is to be called regularly -- per-frame. This is most necessary to update the timeout timer for devices using the external clock source. The duration of the timeout is in "ticks" (calls toSioTick
).A simple data integrity test is implemented with the
SioPacket
functions. This takes the first two bytes of the buffer for a magic number and simple checksum. Sio itself doesn't do anything to handle the result of this test, it's expected that the controlling context (the app-specific protocol) will deal with it.