Loading...
Searching...
No Matches
phyduino Namespace Reference

Phyduino Pico board library for MicroPython. More...

Classes

class  Led
 Gives control of the built-in LED (D8) on GPIO5. More...
class  MAX11635
 Driver for the on-board MAX11635 12-bit ADC (U5). More...
class  STUSB4500
 Driver for the on-board STUSB4500 USB-PD sink controller (U6). More...

Functions

 version ()
 Gets the library version.
 gpio (name)
 Gets the GPIO number from the board header name.
 pin (name, mode="in", pull=None, value=None)
 Configures the GPIO pin from board header name.
 pwm (name, freq=1000, duty_u16=0)
 Configures GPIO pin for PWM output.
 external_adc ()
 Initializes _ext_adc variable for use by the user.
 analog_averaging (samples)
 Averages several readings for every analogue result.
 analog_read (name)
 Reads an analog pin as a 12-bit data.
 analog_full_scale_millivolts (name)
 Returns the maximum input voltage an analog pin can measure.
 analog_millivolts (name)
 Reads an analog pin in millivolts.
 analog_volts (name)
 Reads an analog input pin in volts.
 analog_differential_millivolts (plus, minus)
 The voltage of one analog input pin minus another, in millivolts.
 vbus_volts ()
 Reads the USB input voltage supply voltage (VBUS, also on the header's VIN pin).
 cpu_temperature ()
 Gets the RP2040's internal temperature.
 usb_pd ()
 The board's STUSB4500, set up on first use.
 i2c (freq=100_000)
 Creates I2C object for control on the pins, SDA (D18) and SCL (D19).
 spi (baudrate=1_000_000, polarity=0, phase=0)
 Creates SPI1 object to controller the SPI bus on D13 (SCK), D11 (MOSI) and D12 (MISO).
 uart (number=0, baudrate=115200)
 Creates a UART object for use on the board header.

Variables

dict PINS
 Every pin name on the board and the RP2040 GPIO it connects to.
int ADC_FULL_SCALE_MILLIVOLTS = 3300
 Maximum input voltage of A0-A2 (RP2040 ADC) in millivolts.
int EXT_ADC_FULL_SCALE_MILLIVOLTS = 2048
 Maximum input voltage A3-A5 (MAX11635, LM4040 reference on AREF) in millivolts.
 led = Led()
 The on-board LED: a Led object.

Detailed Description

Phyduino Pico board library for MicroPython.

Built into the Phyduino Pico MicroPython firmware, so your own main.py can use it:

import phyduino as mcu
mcu.led.on()
print(mcu.analog_volts("A3"))
button = mcu.pin("D2", "in", pull="up")

Pins use the names printed on the board: "D0"-"D13", "D18", "D19", "A0"-"A5", plus "SDA", "SCL" and "LED". Names are not case-sensitive.

A0-A2 are read by the RP2040 (0-3.3 V). A3-A5 are read by the on-board MAX11635 ADC (0-2.048 V) and are analog only. The same functions work on all six analog inputs.

Licence: GPL-3.0.