from machine import Pin from rp2 import PIO, StateMachine, asm_pio from time import sleep import array import uctypes from uctypes import BF_POS, BF_LEN, UINT32, BFUINT32, struct GPIO_BASE = 0x40014000 GPIO_CHAN_WIDTH = 0x08 GPIO_PIN_COUNT = 30 PAD_BASE = 0x4001c000 PAD_PIN_WIDTH = 0x04 ADC_BASE = 0x4004c000 PIO0_BASE = 0x50200000 PIO1_BASE = 0x50300000 DMA_BASE = 0x50000000 DMA_CHAN_WIDTH = 0x40 DMA_CHAN_COUNT = 12 DMA_SIZE_BYTE = 0x0 DMA_SIZE_HALFWORD = 0x1 DMA_SIZE_WORD = 0x2 # DMA: RP2040 datasheet 2.5.7 DMA_CTRL_TRIG_FIELDS = { "AHB_ERROR": 31<