Category Archives: Uncategorized

My goal is to use #dlang in 2022

For a few years now, I’ve held the view “stop futzing around and just use C/C++ or Python”. Recently, I had been poking around with Zig, and it seemed a nice language. It got me to wondering if I should … Continue reading

Posted in Uncategorized | 1 Comment

Raspberry Pi FTW

Microcontrollers are a lot of fun to play around with. I’m looking to tinker around with a clock that I got working on my Raspberry Pi 0. On all due consideration, I’d say that if your project doesn’t need real-time … Continue reading

Posted in Uncategorized | Leave a comment

echo in #odinlang

I heard of Odin recently by way of Zig. I decided to see if I could implement echo in Odin. Here’s my code: Who will win, I wonder: Odin or Zig? Multi-value return statements in Odin look interesting. I might … Continue reading

Posted in Uncategorized | Leave a comment

libopencm3: a limited success

I was interested in getting external interrupts working on my black pill. I found the easiest and most reliable way to get it going was using ST’s CubeIDE and MX utils. It’s probably the best way of getting a piece … Continue reading

Posted in Uncategorized | Leave a comment

Rust is a whale of fail

So I saw an interesting program called r4d, which is a macro processing language modelled on m4. To install it: The first thing cargo does is update its dependency tree, or something. This takes awhile. That’s my first complaint. So … Continue reading

Posted in Uncategorized | Leave a comment

A little look at disassembly of #ziglang

I thought I’d see if I could peek and poke memory addresses for my mcu. Here, for example, is how to set or clear a GPIO pin on my STM32: “pin” should have its parameter declared as comptime. If you … Continue reading

Posted in Uncategorized | Leave a comment

Bitcasting in #ziglang

Here’s a useful feature I found in Zig: you can convert from a struct to a number, and back again. Here’s an example: The output is as one might expect: The code converts from a struct to a u32 and … Continue reading

Posted in Uncategorized | Leave a comment

Dumping HAL config changes on an STM32

Using the HAL is a more reliable way of configuring hardware than hand-coding. I’d prefer to do things a bit more “bare metal” and avoid the use of Cube IDE so that I can convert my projects to use CMSIS. … Continue reading

Posted in Uncategorized | Leave a comment

PWM on STM32F411 using #ziglang

I translatedmy CMSIS code over to Zig. It was tested on a blackpill, and should have no trouble working on an equivalent Nucleo. The following code creates a PWM signal of 500Hz at 50% duty cycle to PB5: Some explanation … Continue reading

Posted in Uncategorized | Leave a comment

PWM on CMSIS (STM32F411)

Getting PWM to work on an STM32F411 is somewhat tricky, as there are a few moving parts to consider. You can cheat a little by using CubeMX to set things up. If you want to do things the “proper” way, … Continue reading

Posted in Uncategorized | Leave a comment