3 ms·
There are various alternatives, but generally the approach is to know what address you need in advance and create an object for it at compile time that can be a
by pjc50 8y ago
There are various alternatives, but generally the approach is to know what address you need in advance and create an object for it at compile time that can be accessed type-safely.
e.g. https://zinc.rs/apidocs/ioreg/index.html https://zinc.rs/apidocs/ioreg/index.html
or the longer but more detailed http://blog.japaric.io/brave-new-io/ http://blog.japaric.io/brave-new-io/ , which covers various approaches. It even points out that you can use the type system to enforce that peripherals are only accessed from multiple threads or parts of the program in a safe manner, which you can't do if you can just reinterpret-cast into anything.