Skip to content

Error with MicroPython 1.25.0 on Raspberry PI Pico W #3

Description

@ohault

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions