Get the latest tech news

Memory-mapped IO registers in Zig. (2021)


Kevin Lynagh and I spent some time playing around with zig on nrf52 boards. He's written about the experience here.

I wanted to additionally highlight the api we used for memory-mapped IO registers because it shows off some nice features of zig. For example, on the nRF52833 board writing the value 0b11 to address 0x708 will set the 3rd GPIO pin to output mode and disconnect the input buffer. We check at compile time and emit a nice error message with a call stack if the types don't match.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Memory

Memory

Photo of zig

zig

Photo of mapped IO registers

mapped IO registers

Related news:

News photo

Zig 0.12.0 Release Notes

News photo

NASA tries to jog Voyager 1's memory from 15B miles away

News photo

How much memory does a graph take?