Skip to content

Instantly share code, notes, and snippets.

View tannewt's full-sized avatar

Scott Shawcroft tannewt

View GitHub Profile
@tannewt
tannewt / code.py
Created October 25, 2024 17:30
midi to gameboy
import busio
import microcontroller
import time
import random
import _gbio
import adafruit_midi
# TimingClock is worth importing first if present as it
# will make parsing more efficient for this high frequency event
# Only importing what is used will save a little bit of memory
@tannewt
tannewt / intellikeys.ksy
Created July 11, 2023 21:27
Kaitai struct parsing for Intellikeys hid reports
meta:
id: intellikeys
file-extension: intellikeys
seq:
- id: reports
type: report
repeat: eos
types:
report:
seq:
@tannewt
tannewt / usb_hid_report.ksy
Last active July 7, 2023 17:54
HID report parser for kaitai struct
meta:
id: usb_hid
file-extension: usb_hid
bit-endian: le
endian: le
seq:
- id: items
type: item
repeat: eos
enums:
@tannewt
tannewt / usb.ksy
Last active July 6, 2023 23:43
Start of Kaitai struct definition for usb descriptors
meta:
id: usb_descriptors
endian: le
bit-endian: le
seq:
- id: descriptor
type: usb_descriptor
repeat: eos
enums:
descriptor_type:
@tannewt
tannewt / fnt.ksy
Created July 6, 2023 20:34
Start of a Kaitai struct definition for the FNT font file format
meta:
id: fnt
file-extension: fnt
endian: le
bit-endian: le
seq:
- id: df_version
type: u2
- id: df_size
type: u4
from elftools.dwarf.descriptions import describe_form_class
from elftools.elf.elffile import ELFFile
import sys
import json
import pathlib
std_to_type = {
"uint8_t": ("B", "int"),
@tannewt
tannewt / _canio.pyi
Last active August 19, 2020 19:54 — forked from jepler/_canio.pyi
class Filter:
def __init__(self, address: int, *, extended: bool = False, mask: Optional[int] = None):
"""Construct a CanFilter with the given properties.
If mask is not None, then the filter is for any sender which matches all
the nonzero bits in mask. Otherwise, it matches exactly the given address.
If extended is true then only extended addresses are matched, otherwise
only standard addresses are matched.
"""
# Example of using the Adafruit IO CircuitPython MQTT client
# to subscribe to an Adafruit IO feed and publish random data
# to be received by the feed.
#
# Example by Tony DiCola for Adafruit Industries
# Modified by Brent Rubell for Adafruit Industries, 2019
import time
from random import randint
from pimoroni_pms5003 import PMS5003
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3ffe8100,len:0x4
load:0x3ffe8104,len:0x1914
load:0x40050000,len:0x14cc
load:0x40054000,len:0x210c
entry 0x400502e0
AutoSunglasses/code.py
18:from adafruit_circuitplayground.express import cpx
FruitBox_Sequencer/main.py
7:from adafruit_circuitplayground.express import cpx
Sensor_Plotting_With_Mu_CircuitPython/soil_moisture.py
2:from adafruit_circuitplayground.express import cpx
Sound_Reactive_Ears/code.py