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

counters: add "counters-disabled" feature flag #1658

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Mar 14, 2024

The ringbuf crate has a "disabled feature flag, which disables ring buffers, intended for use on memory-constrained targets. Currently, setting the "disabled" feature flag still enables counters for ring buffers declared using the counted_ringbuf! macro, because counters generally require less RAM than full ringbufs. However, on some targets, even counters are too large, especially when a ringbuf's entry type has too many variants (e.g. see this comment from @bcantrill --- the i2c_driver ringbuf must disable counters in order to fit in Donglet's RAM).

Therefore, this commit adds an additional "counters-disabled" feature flag to the ringbuf crate, to allow disabling counters as well as ring buffers.

The `ringbuf` crate has a `"disabled` feature flag, which disables ring
buffers, intended for use on memory-constrained targets. Currently,
setting the `"disabled"` feature flag still enables counters for ring
buffers declared using the `counted_ringbuf!` macro, because counters
generally require less RAM than full ringbufs. However, on some targets,
even counters are too large, especially when a ringbuf's entry type has
too many variants (e.g. see [this comment][1] from @bcantrill --- the
`i2c_driver` ringbuf must disable counters in order to fit in Donglet's
RAM).

Therefore, this commit adds an additional `"counters-disabled"` feature
flag to the `ringbuf` crate, to allow disabling counters as well as ring
buffers.

[1]: #1657 (comment)
Copy link
Collaborator

@bcantrill bcantrill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great -- thank you! (And it will allow me to enable counters for #1657!)

@hawkw hawkw merged commit f1c7898 into master Mar 14, 2024
83 checks passed
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.

None yet

2 participants