Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple set_serial_message_callback #1

Conversation

boozook
Copy link

@boozook boozook commented Apr 29, 2024

Simpler solution with just static boxed fn as trait object. Not perfect because Box+TratiObj gives two derefs. But it easier, without static hashmap (or variadic) and works like update callback. More details and reasons for this in that comment.

How to test it:

# Build, install, run:
cargo playdate run -p=playdate-system --example=set-serial-message-callback --features=sys/lang-items,sys/entry-point --device
--no-read

# Then send messages:
pdtool send msg "one" && pdtool read
pdtool send msg "two" && pdtool read
pdtool send msg "three" && pdtool read
# ...

# Output should be like this:
# serial_message_callback: one
# serial_message_callback: two
# serial_message_callback: three
# ...

@github-actions github-actions bot added the api label Apr 29, 2024
@paulyoung paulyoung merged commit bdffba2 into paulyoung:paulyoung/serial-message-callback May 1, 2024
1 check passed
@paulyoung
Copy link
Owner

Thanks!

@boozook boozook deleted the fix-serial-message-callback branch May 1, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants