# RP2040 - Most simple PIO application, toggle GPIO-26
# by Anthony Vogelaar, Perth Scotland
# rev 0.10  2025-08-22  Initial release

from	machine		import	Pin
import	rp2

# ======================= PIO functions ======================

# High freq output 62.5 MHz on GPIO-26
@rp2.asm_pio(set_init=rp2.PIO.OUT_LOW)
def highFreq():
    set(pins, 1) 
    set(pins, 0) [8]

# ======================= State machine ========================

# helper class for PIO StateMachines
class PioMach:
    
    def  __init__(self, program, freq=125_000, id=0, **kwargs):
        sm = rp2.StateMachine(id, program, freq, **kwargs)
        sm.active(True)

# ========================== main ==============================

sm = PioMach(highFreq, set_base=Pin(26))								# 62.5 MHz on GPIO-16

# =========================== end ==============================