Tag Archives: cli

Meet Depot, an RP2040-based multi-bus adaptor for Macs and Linux PCs

I’d like to introduce you to Depot, the new name for an expanded version of the Raspberry Pi RP2040-based adaptor I launched last year as cli2c. Why the name change? In addition to I²C, the firmware and the client-side code that interacts with it, now supports 1-Wire, and more buses will be supported soon.

Depot client and adaptor firmware in action
Depot client and adaptor firmware in action
Continue reading

Pico SDK 1.5.0 revamps IO over USB — and makes it work

The Raspberry Pi company released version 1.5.0 of the Pico SDK a week ago — right after I issued the latest version of my desktop computer-oriented I²C adaptor, which is based on the Pico’s RP2040 chip. If I’d have known about the SDK update, I would have held back — SDK 1.5.0 solves an irritating problem I’d faced with unexplained adaptor firmware hangs.

The RP2040 based I2C adaptor here running on a Pimoroni Tiny 2040 and with a matrix LED connected
Continue reading

How to copy files to a Pico on a Ventura Mac error free

macOS 13.0.0 Ventura introduced an irritating problem for all us Mac-based Raspberry Pi Pico programmers: Finder no longer allows you to copy .uf2 files to a mounted Pico. It’s not a forbidden operation, but it does trigger an error that prevents the copy from taking place. This is undoubtedly the ‘new normal’, so here are some ways to circumvent the error. I’ll save the best one until last.

The macOS Ventura copy-to-Pico-in-Finder error
The macOS Ventura copy-to-Pico-in-Finder error
Continue reading

How to talk to I2C sensors, displays from… Linux

T’other week, I wrote about my work on building a Raspberry Pi RP2040-based I²C host device and some macOS client software to control it. I mentioned that I might get the latter running under Linux too. I now have, and it does.

The matrix display client and the CPU activity display example running on a Raspberry Pi 400
The matrix display client and the CPU activity display example running on a Raspberry Pi 400
Continue reading

How to talk to I2C sensors, displays from a Mac

This post was originally going to be about building a tool to access I²C devices on a Mac, reaching them via USB and an Excamera Labs I2CMini adaptor board. But then I accidentally snapped the pins and board traces off my I2CMini, so I had to go back to the drawing board. Now it’s about accessing I²C devices on a Mac using a Raspberry Pi Pico, or any other RP2040-based board, as the adaptor.

An I2C matrix display showing my Mac's CPU utilisation graphically
I2C antics: a CPU utilisation readout using an RP2040-based board as an I2C bridge to a matrix LED
Continue reading

How to manage multiple serial devices on a Mac

I connect to my Mac many USB devices that communicate over a serial (UART) bus to send debug information to the host or to receive data and code. You know, Raspberry Pi Picos, Adafruit Feathers, FTDI cables — that kind of thing. Often I have more than one connected. Is there an easy way to see what’s connected without listing /dev every time and to remember connected devices’ paths?

A USB serial device attached to my Mac
Continue reading

Notarise macOS command line apps more quickly

It’s June once more, and time for Apple’s Worldwide Developers’ Conference (WWDC). This is a chance to learn about new functionality and, yes, discover initiatives announced at previous WWDCs that you completely missed the first time around. A case in point: Apple’s revamp of how apps are notarised at the command line, which was revealed at WWDC 21 but I only encountered this week.

Continue reading

How to write Unix man pages for macOS command line apps

Over the last few years I’ve released a number of command line utilities for macOS. I’ve always included online help within them, triggered with the --help switch, but I recently wondered how I might provide Unix Manual pages too. It would allow users to call up help with the CLI command man as well as a command switch. Belts and braces, perhaps, but I’m a completist and, more to the point, didn’t know how it was done and wanted to learn.

Continue reading

Tackle async signal safety in Swift

How do you safely interrupt a command-line program written in Swift? This question was posed to me this week by a reader who got in touch to point out that boilerplate code included in my How to write macOS command line tools in Swift post might not be totally safe: it could leave a program and system in an undefined state, which is never a good thing. So I took a closer look.

Continue reading

Stay ahead of git with this sharp script

I work on quite a few git repositories at once, and I don’t always commit changes in one before making changes to another. Or if I do, I don’t always push the changes up straight away. That might not be best practice in software development, but hey, it’s what I do. The issue for me is remembering what state each repo is in. Here’s the script I use to tell me.

Continue reading