I2C, SPI and UART set up on the header pins. More...
Functions | |
| 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. | |
I2C, SPI and UART set up on the header pins.
Each function returns a standard MicroPython machine.I2C, machine.SPI or machine.UART; see the MicroPython documentation for their methods.
| i2c | ( | freq = 100_000 | ) |
Creates I2C object for control on the pins, SDA (D18) and SCL (D19).
There are no pull-up resistors on the board for these pins: use a module that has them, or attach 4.7 kOhm pull-up resistors to each I2C pins. The on-board USB-PD controller is on a separate bus and never appears in scan(). Call i2c() once and keep the object.
Refer to MicroPython documentation for more information about the returned object : https://docs.micropython.org/en/latest/library/machine.I2C.html
| freq | Clock in Hz: 100 kHz works with almost any module; many also run at 400 kHz. |
| 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).
This function creates an SPI1 object to allow access to the SPI internal peripheral on the RP2040. Chipselect or multiple chipselect can be any GPIO pin. The chipselect pin(s) are controlled by the user.
Refer to MicroPython documentation for more information about the returned object : https://docs.micropython.org/en/latest/library/machine.SPI.html
| baudrate | Clock in Hz. |
| polarity | Clock idle level, 0 or 1. |
| phase | 0 samples on the first clock edge, 1 on the second. |
| uart | ( | number = 0, | |
| baudrate = 115200 ) |
Creates a UART object for use on the board header.
Initializes UART peripheral based on the number parameter. The only valid number are 0 and 1. The default pins for UART0 is TX = D1 and RX = D0. For UART1 the default pins are TX = D4 and RX = D5.
Refer to MicroPython documentation for more information about the returned object : https://docs.micropython.org/en/latest/library/machine.UART.html
| number | 0 or 1. |
| baudrate | Bits per second; both ends must match. |
| ValueError | number is not 0 or 1. |