Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ringbuf cleanup #6915

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

Merged
merged 2 commits into from
Sep 25, 2022
Merged

ringbuf cleanup #6915

merged 2 commits into from
Sep 25, 2022

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Sep 16, 2022

Derived from #6124, with further cleanup:

  • Now use ringbuf_init() in various places instead of reaching inside the ringbuf struct.
  • ringbuf no longer has the "capacity is one less than size" oddity. It used an extra slot to indicate full and empty. Now it uses a count. Sometimes this technique is used when doing atomic operations, but we already don't expect it to be atomic. Added a comment to that effect. Changed ringbuf_capacity() to ringbuf_size() to simplify naming.
  • ringbuf_free() started to rely on gc to free its buffer in PacketBuffer ringbuf size #6800. Since it now doesn't really free, the name was changed to ringbuf_deinit(). Removed some flags about whether a ringbuf buffer is heap-allocated or not, because now it doesn't matter.
  • Improved internal names.
  • Removed 16-bit peek routine, which was not used anywhere.
  • Fixed up unix coverage test of ringbuf.

Tested by:

  • connecting two RP2040 UARTs together and sending longer and longer byte strings
  • nRF BLE heart rate monitor, to test PacketBuffer.
  • BLE UART test

Copy link

@jepler jepler left a comment

Choose a reason for hiding this comment

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

I didn't spot any further problems, but I didn't test either.

@dhalbert dhalbert merged commit de80db6 into adafruit:main Sep 25, 2022
@dhalbert dhalbert deleted the ringbuf-cleanup branch September 25, 2022 21:50
@tlyu
Copy link

tlyu commented Sep 25, 2022

I tested the pull request build artifacts with the ble_adafruit_clue.py example on a Clue and confirmed that the Tone service now works from the iOS Bluefruit Playground client. (It did not work with previous CircuitPython 8.x builds.)

@dhalbert
Copy link
Collaborator Author

Hmm - I thought I had merged #6800 (which was added to 7.3.x) into main, but I maybe I didn't? Anway, glad it fixed the Tone Service in 8.0.0 as well.

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.

Incorporate ringbuf improvements from #6214
3 participants