To avoid errors with viper, I had to modify RaspberryScpiPico.py like this
...
import sys
#from micropython import const, viper
from micropython import const
import machine
...
@micropython.viper
def vp_set_pin_hi(pin: int):
""" Viper code to set pin high
:param int pin: IO pin 0-29
"""
gpio_oe_set_p = ptr32(_REG_GPIO_OE_SET)
gpio_out_set_p = ptr32(_REG_GPIO_OUT_SET)
gpio_oe_set_p[0] = 1 << pin
gpio_out_set_p[0] = 1 << pin
@micropython.viper
def vp_set_pin_lo(pin: int):
""" Viper code to set pin low
:param int pin: IO pin 0-29
"""
gpio_oe_set_p = ptr32(_REG_GPIO_OE_SET)
gpio_out_clr_p = ptr32(_REG_GPIO_OUT_CLR)
gpio_oe_set_p[0] = 1 << pin
gpio_out_clr_p[0] = 1 << pin
@micropython.viper
def vp_set_pin_mode_in(pin: int):
""" Viper code to set a pin input mode
:param int pin: IO pin 0-29
"""
gpio_oe_clr_p = ptr32(_REG_GPIO_OE_CLR)
gpio_oe_clr_p[0] = 1 << pin
@micropython.viper
def vp_set_pin_mode_out(pin: int):
""" Viper code to set a pin output mode
:param int pin: IO pin 0-29
"""
gpio_oe_set_p = ptr32(_REG_GPIO_OE_SET)
gpio_oe_set_p[0] = 1 << pin
To avoid errors with viper, I had to modify RaspberryScpiPico.py like this