Skip to content

Instantly share code, notes, and snippets.

View jepler's full-sized avatar

Jeff Epler jepler

View GitHub Profile
from math import sin
import sdcardio
import storage
import audiobusio
import audiocore
import audiomixer
import audiomp3
import board
import time
import math
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#define N (1000000)
void clock_test(clockid_t clock, char *clock_str) {
struct timespec ts, t0, t1;
int r = clock_gettime(clock, &ts);
import displayio
displayio.release_displays()
import audiobusio
import audiocore
try:
import audiomp3
except:
audiomp3 = None
import board
import time
import gc
import os
import ssl
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_connection_manager
from digitalio import DigitalInOut
import board
import busio
interface=shugart
pin02=high # 8/5 select - low is 5.25"
# nrdy is inverted but then goes to a bunch of logic - check at fd1771 pin 32 (active high)
pin34=low # nrdy # nrdy
display-type=oled128x64-rotate-narrow-inverse
side-select-glitch-filter = 50
track-change = instant
write-drain = instant
index-suppression = no
head-settle-ms = 10
import ulab
import digitalio
import rp2pio
import array
import board
import adafruit_pioasm
import picodvi
import displayio
vsync = 11
@jepler
jepler / 0000README.md
Last active March 13, 2024 15:09
Reading RP2040 BOOTSEL pin from code

It turns out you CAN read the pico BOOTSEL pin from software.

I became aware of this possibility after pimoroni tweeted that you could use the BOOTSEL button as a MIDI trigger on their upcoming "Tiny2040". We speculated whether there was a small HW circuit to accomplish this, or if it was SW only. Now I have the answer.

I was also heavily informed by the bootloader source, the body of the reading code is taken directly from there with adjusted timings.

The general idea:

  • Pressing the button applies a strong pull-down.
  • Normally after start-up, this pin is always being driven by the Pico's QSPI peripheral, so the button has no effect
@jepler
jepler / claude-3-opus-20240229.md
Last active March 10, 2024 03:02
TTRPG prompts evaluated in several LLMs

A dialog, where USER interacts with AI. AI is helpful, kind, obedient, honest, and knows its own limits.

Write an evocative description of the fish market in a 17th century Asian city.

As the sun rises over the bustling 17th-century Asian city, the fish market comes alive with a symphony of sights, sounds, and smells. The air is thick with the briny scent of the ocean, mingling with the pungent aroma of spices and the smoky essence of charcoal fires.

Fishmongers, with weathered faces and calloused hands, arrange their catch on wooden stalls, the iridescent scales of the fish glinting in the early morning light. Silver-bellied tuna, plump red snappers, and slender eels lay side by side, their eyes still gleaming with the memory of the deep sea.

The market hums with activity as customers, from wealthy merchants to humble housewives, haggle with the vendors for the best price. The fishmongers call out their wares, their voices rising above the din of the crowd, each trying to outdo the other with promi

A dialog, where USER interacts with AI. AI is helpful, kind, obedient, honest, and knows its own limits.

Write an evocative description of the fish market in a 17th century Asian city.

In the heart of a bustling 17th century Asian city, the fish market comes to life as the first light of dawn breaks over the horizon. The air is filled with the cacophony of vendors hawking their wares and the rhythmic banter of buyers and sellers haggling over prices.

The ground is slick with seawater, which mingles with the blood of freshly caught fish and the dirt and grime of the city. The scent is a pungent mix of saltwater, fish, and sweat, a smell that is both enticing and repelling.

The market is alive with color and movement. Fish of every shape, size, and hue are displayed on wooden tables and in large woven baskets. Vibrant red snapper, iridescent bluefin tuna, and silvery mackerel glisten in the early morning light. Octopus and squid are piled high, their tentacles reaching out like seeking tendrils. Crabs

import board
import busio
import digitalio
import adafruit_requests
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_socket as socket
import ssl
print("Wiznet5k WebClient Test")