Repository navigation
Add the event queue and the device monitor - #20
Merged
Merged
Conversation
The event queue gives every driver a lock-free queue that its interrupt writes and the main loop reads, and read() merges all queues oldest first. attach() returns false for a refused queue and points its out parameter at a queue that drops every event. The device monitor checks each watched driver on the driver tick every 100 ms and publishes DEVICE_FAILED and DEVICE_RECOVERED for every part whose state changed. Its queue lies in RAM2, which the firmware model counts against the pool. Computer tests cover both libraries, and the Teensy test image gains event-queue.from-interrupts, which publishes from two interrupts of different priorities. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The input-handling gist and the device monitor's part of the error-handling gist are gone, since the event queue and the device monitor stand as libraries. The driver gists take the libraries' names: DEVICE_FAILED, DEVICE_RECOVERED, the UPPER_CASE Device list and attach() with its out parameter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
firmware/lib/event-queue): every driver gets a lock-free queue. Its interrupt writes to the queue and the main loop reads from it.read()merges all queues, oldest event first.attach()returns false for a refused queue and points its out parameter at a queue that drops every event.firmware/lib/device-monitor): checks each watched driver on the driver tick every 100 ms. It publishesDEVICE_FAILEDandDEVICE_RECOVEREDfor every part whose state changed. Its queue lies in RAM2, andmodel/firmware/figures.pycounts it against that pool.DEVICE_FAILED,DEVICE_RECOVERED, the UPPER_CASE device list andattach()with its out parameter.Tests
test_event-queueandtest_device-monitor.event-queue.from-interrupts: two interrupts at different priorities publish into the queue. In the run it read 499999 and 384615 events.🤖 Generated with Claude Code