File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 2828# Import NumPy.
2929from ulab import numpy as np
3030
31- # Import machine and rp2 for I2C and PIO.
32- import machine
33- from machine import Pin
34- import rp2
35- i2c = machine .I2C ()
36- rp2 .PIO (1 ).gpio_base (16 )
31+ # Import the Pin class for the board's default pins, as well as SPI and I2C.
32+ from machine import Pin , SPI , I2C
33+
34+ # When the Red Vision Kit for RedBoard is used with the IoT RedBoard RP2350,
35+ # both the display and camera use GPIO 16-47 instead of GPIO 0-31, so we need to
36+ # adjust the base GPIO for PIO drivers.
37+ import sys
38+ if "IoT RedBoard RP2350" in sys .implementation ._machine :
39+ import rp2
40+ rp2 .PIO (1 ).gpio_base (16 )
3741
3842# Image size and bytes per pixel (depends on color mode). This example defaults
3943# to 320x240 with BGR565.
5963# color format. SPI is used here for compatibility with most platforms, but
6064# other interfaces can be faster.
6165interface_display = rv .displays .SPI_Generic (
62- spi = machine . SPI (
66+ spi = SPI (
6367 baudrate = 24_000_000 ,
6468 ),
6569 pin_dc = Pin .board .DISPLAY_DC ,
8791)
8892driver_camera = rv .cameras .OV5640 (
8993 interface = interface_camera ,
90- i2c = i2c ,
94+ i2c = I2C () ,
9195 continuous = True , # Continuous capture mode for fastest frame rate.
9296 height = height ,
9397 width = width ,
Original file line number Diff line number Diff line change 1414# When the Red Vision Kit for RedBoard is used with the IoT RedBoard RP2350,
1515# both the display and camera use GPIO 16-47 instead of GPIO 0-31, so we need to
1616# adjust the base GPIO for PIO drivers
17- import rp2
18- rp2 .PIO (1 ).gpio_base (16 )
17+ import sys
18+ if "IoT RedBoard RP2350" in sys .implementation ._machine :
19+ import rp2
20+ rp2 .PIO (1 ).gpio_base (16 )
1921
2022# Import the camera driver
2123try :
You can’t perform that action at this time.
0 commit comments