from rp2 import *
from machine import *
import uarray
l = Pin(0, Pin.OUT)
regdata = uarray.array('i',[
0xd0000000 + 0x010, # 0 SIO OUT
0xd0000000 + 0x018, # 4 SIO OUT_CLR
0xd0000000 + 0x014, # 8 SIO OUT_SET
1 << 0 # 12 GP0
])
@micropython.asm_thumb
def led_off(r0):
mov(r1,r0) # store argument (16B array) to r1
ldr(r2,[r1,4]) # load OUT_CLR address
ldr(r0,[r1,12]) # mask data to store on OUT_CLR address
str(r0,[r2,0]) # store 0x00000001 on [OUT_CLR]
@micropython.asm_thumb
def led_on(r0):
mov(r1,r0) # store argument (16B array) to r1
ldr(r2,[r1,8]) # load OUT_SET address from array
ldr(r0,[r1,12]) # mask data to store on OUT_SET address
str(r0,[r2,0]) # store 0x00000001 on [OUT_SET]
@micropython.asm_thumb
def asm_delay(r0):
mov(r4, r0) # move argument (number of iterations) to r4
label(delay_off) # define delay as a part of the loop
sub(r4, r4, 1) # substract 1 from content of r4 (decrement)
cmp(r4, 0) # compare r4 with 0
bgt(delay_off) # if r4 is bigger than 0, jump back to label
while True:
led_on(regdata)
asm_delay(5599900)
led_off(regdata)
asm_delay(5599900)
pico:GP0
pico:GP1
pico:GND.1
pico:GP2
pico:GP3
pico:GP4
pico:GP5
pico:GND.2
pico:GP6
pico:GP7
pico:GP8
pico:GP9
pico:GND.3
pico:GP10
pico:GP11
pico:GP12
pico:GP13
pico:GND.4
pico:GP14
pico:GP15
pico:GP16
pico:GP17
pico:GND.5
pico:GP18
pico:GP19
pico:GP20
pico:GP21
pico:GND.6
pico:GP22
pico:RUN
pico:GP26
pico:GP27
pico:GND.7
pico:GP28
pico:ADC_VREF
pico:3V3
pico:3V3_EN
pico:GND.8
pico:VSYS
pico:VBUS
led1:A
led1:C