Skip to content

Instantly share code, notes, and snippets.

jedp /
Last active January 9, 2024 05:17
SPI DMA LED hacking

Controlling addressable LEDs with STM32 SPI + DMA


RGB5050 LEDs are programmed by sending a stream of 24-bit GRB packets, MSB first.

The logical 1s and 0s in the packets are encoded on a single line which is sent high or low with these timings:

  • 0 -> 0.3µs high ± 0.15µs, 0.9us low ± 0.15µs
jedp /
Last active February 17, 2022 19:16
Fix for InetAddress.getLocalHost on apple M1: Prevent hanging on inane DNS lookup

Fixing Ludicrous Java Localhost DNS Lookup on Mac

I recently started using the excellent adm wrapper for the android debug bridge.

I quickly noticed that my app was hanging on startup on an aarch_64 (Apple M1) machine.

Fortunately, vert.x, a dependency of adm, gave the following warning:

[vertx-blocked-thread-checker] WARN io.vertx.core.impl.BlockedThreadChecker - Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 4985 ms, time limit is 2000 ms
jedp / xmas-lights.3.ino
Last active August 29, 2015 14:11
Illuminating one of two LEDs, depending on eTape level
#define ETAPE A0
// Set crucial level as appropriate for your needs.
// For me, 687 indicates three inches of water.
#define CRUCIAL_LEVEL 687
#define LED_RED 13
#define LED_GREEN 12
float resistance;
jedp / xmas-lights.2.ino
Last active August 29, 2015 14:11
Reporting low water level with the eTape
#define ETAPE A0
// Set crucial level as appropriate for your needs.
// For me, 687 indicates three inches of water.
#define CRUCIAL_LEVEL 687
#define LED_RED 13
float resistance;
void setup(void) {
jedp / xmas-lights.1.ino
Created December 23, 2014 01:19
Connecting the eTape to the Arduino
#define ETAPE A0
float resistance;
void setup(void) {
void loop(void) {
resistance = analogRead(ETAPE);
jedp / .vimrc
Created August 12, 2014 02:57
if version < 704
" if we are somehow running a version lower than 7.4,
" something's wrong, so just stop processing this file.
" auto reload vimrc after edit
autocmd! bufwritepost .vimrc source %
" vi? is it even possible to run original vi anymore?
jedp / about_proxy_object_project.rb
Last active August 29, 2015 14:05
Create a proxy object class
# Answer to a ruby koan:
# Project: Create a Proxy Class
# In this assignment, create a proxy class (one is started for you
# below). You should be able to initialize the proxy object with any
# object. Any messages sent to the proxy object should be forwarded
# to the target object. As each message is sent, the proxy should
# record the name of the method send.
jedp / about_triangle_project_2.rb
Created August 9, 2014 22:47
Heroku koans: syntax error in triangle project 2?
# XXX why does the second cause a syntax error
# in the heroku web app, but not in my irb repl!?
class TriangleError < Exception
def triangle(a, b, c)
sides = [a, b, c]
jedp / .mozconfig
Created May 19, 2014 18:06
. $topsrcdir/browser/config/mozconfig
# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=../build_mc
# -s makes builds quieter by default
# -j4 allows 4 tasks to run in parallel. Set the number to be the amount of
# cores in your machine. 4 is a good number.
mk_add_options MOZ_MAKE_FLAGS="-s -j6"
jedp / hgrc
Created May 16, 2014 02:50
username = Jed Parsons <>
# git diff is required so binary files don't break
git = 1
showfunc = True
unified = 8