Skip to content

Separate the character processing from the interrupt handler using ring buffer #3

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

Open
wants to merge 5 commits into
base: NEWESTER
Choose a base branch
from

Conversation

mpetch
Copy link

@mpetch mpetch commented Oct 27, 2024

Separate the character processing from the interrupt handler using a ring buffer:

  • Create ring buffer for the scan codes in keybuff.c and keybuff.h
  • Remove the character processing from the interrupt handler keyboard.c by using the new scancode ring buffer
  • Move the character processing to new files keyproc.c and keyproc.h which will be called outside of an interrupt. keyboard_flush will flush the contents of the scancode buffer. Calling process_key can be called outside of an interrupt to process the next scancode if one is available. Calling process_keys will process all the keys until the scancode buffer is empty.
  • Modify main.c to go into an infinite loop calling process_keys waiting for an interrupt between each call.
  • Modify TaskA to call process_keys so that keyboard input continues to be processed while the multitasking code is running
  • Other minor fixes.

Note: I didn't fix the bugs related to task switching that only allows TaskA and TaskB to switch.


Information on ring buffers (circular buffers) can be found on Wikipedia and Stackoverflow.

@mpetch mpetch changed the title Split the character processing from the interrupt handler using ring buffer Separate the character processing from the interrupt handler using ring buffer Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant