Skip to content

Volatile Quantities #606

Answered by mpusz
HazardyKnusperkeks asked this question in Q&A
Sep 1, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

This is an excellent question. It took me so long because I was unsure what to answer at first. I asked a few experts in the domain about this. The answer I got was similar to my initial feeling.

The standard library has tried to get away from supporting volatile user types. atomic_signal_fence is supposed to be the mechanism used to synchronize between interrupts / signals and other code, and not volatile. When communicating with special function registers, those should be volatile primitive types, and then quickly turned into quantities afterwards. Such solution is much easier and more robust.

For example, let's consider analog-to-digital converters (ADCs). They often do some measuremen…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@HazardyKnusperkeks
Comment options

@mpusz
Comment options

@HazardyKnusperkeks
Comment options

Answer selected by HazardyKnusperkeks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants