
Access SPI Devices From User Space With spidev
Expose an SPI device as /dev/spidevB.C, set mode, speed and word size with ioctl, and run full-duplex transfers with SPI_IOC_MESSAGE in a small C program.
Tag
362 posts

Expose an SPI device as /dev/spidevB.C, set mode, speed and word size with ioctl, and run full-duplex transfers with SPI_IOC_MESSAGE in a small C program.

Build a 6502 CPU core in C11: registers, the status flags, addressing modes, ADC and SBC with overflow, branches with cycle counts, and a small test program.

Choose between float and double in C by precision, range, memory, SIMD width and hardware support, with accumulation examples and a decision table.

Write a DNS client in C that builds an A query by hand, sends it over UDP, and decodes the reply including name compression, following RFC 1035.

Decide which OpenMP variables are shared, private, firstprivate or lastprivate, and use default(none) so the compiler forces you to state every choice.

Build a small, correct C benchmark harness with clock_gettime(CLOCK_MONOTONIC), a compiler barrier, warm-up, many repetitions and a median in eighty lines.

Detect a lost heartbeat in FreeRTOS by resetting a one-shot software timer on every message, with the timeout callback, ISR resets and per-link supervision.

Build a Windows named pipe server and client in C with CreateNamedPipeW, ConnectNamedPipe and message mode, handle a busy pipe and secure access to it.

Make an RP2040 appear as a USB keyboard with TinyUSB: the HID report descriptor, the 8-byte report, keycodes, press and release, and the LED output report.

CHIP-8 interpreters disagree on shifts, logic flags, FX55 and FX65, sprite wrapping and jump offsets. Learn each quirk and add a switchable quirks structure.

Compare floats in C with an absolute tolerance, a relative tolerance and a ULP distance, see where each fails, and combine them into one safe helper.

Avoid the four classic undefined-behaviour traps in C binary parsers: unaligned casts, signed shifts, overflowing bounds checks and attacker-controlled lengths.