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

implement a finite state machine #1

Open
borb opened this issue Aug 28, 2020 · 0 comments
Open

implement a finite state machine #1

borb opened this issue Aug 28, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@borb
Copy link
Owner

borb commented Aug 28, 2020

implement a timer-driven finite state machine.

the code currently works with an infinite loop reading from usb, then directly sending as many scan codes as needed (except reset, which is a hardware pin). this is fine for now but if the intention is to add mouse and/or joystick support as well, the delays involved whilst sending a keyboard code could interfere with the smooth movement of a mouse.

a timer-driven fsm (flying spaghetti monster?) would involve setting up a delay timer + isr instead of using _delay_ms or _delay_us. then the isr fires, perform the next operation, reset the timer for the wait period, drop out of of the isr and return to the normal loop waiting for something to trigger.

bonus is, if we aren't blocking on _delay_* then we should be able to handle other events which fire at the same time. joysticks are very simplistic so it would be pulldown on the necessary direction pin. mouse, simulate the h/v pulse.

it might work. it's worth a shot.

@borb borb added the enhancement New feature or request label Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant