Skip to content

Instantly share code, notes, and snippets.

# RP2 DMA tests based on following projects
# - https://github.com/rkompass/RPi2040_mPy
# - https://github.com/jbentham/pico
import time
from array import array
import gc
import machine
from machine import Pin, ADC
#!/usr/bin/env python3
"""
Quick script to test DFPlayer Mini MP3 module
- https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299
"""
import sys
from serial import Serial
#!/bin/sh
#
# Quick hack to export a device into container
#
# NOTE:
# - systemd-run cannot be used as capability is dropped from udev service
#
exec > /dev/null 2>&1
#!/usr/bin/env python3
import time
import usbtmc
def capture(fmt='png'):
tmc = usbtmc.Instrument(0x1ab1, 0x04ce)
# magic initialization for DS1000Z
#
#!/usr/bin/env python3
def usage():
p = os.path.basename(sys.argv[0])
return f"""
{p} - Cat USB HID device input
Usage: {p} -a bus.dev [-i ifnum]
Example:
$ {p} -a 1.31
""".lstrip()
#!/usr/bin/env python3
from tkinter import *
def flip(ev):
entry = ev.widget
cur = entry.get()
if '/' in cur:
cur = '/'.join(reversed(cur.split('/')))
entry.delete(0, 'end')
#include "I2CSlaveEx.h"
I2CSlaveEx::I2CSlaveEx(PinName sda, PinName scl) : _i2c() {
i2c_init(&_i2c, sda, scl);
i2c_frequency(&_i2c, 100000);
i2c_slave_mode(&_i2c, 1);
}
void I2CSlaveEx::frequency(int hz) {
#!/usr/bin/env python3
"""
Unofficial CLI tool to control FNIRSI Power Source (DC580, DC6006L, ...)
See Also:
- https://github.com/jcheger/fnirsi-dc580-protocol
"""
import sys
import os
#!/usr/bin/env python3
"""
Unofficial CLI tool to control FNIRSI Power Source (DC580, DC6006L, ...)
See Also:
- https://github.com/jcheger/fnirsi-dc580-protocol
"""
import sys
import os
#!/usr/bin/env python3
import sys
import os
from serial import Serial
def read_frame(io):
sbuf = io.read(1)
if not sbuf[0] == 0x7E: return None