File tree Expand file tree Collapse file tree 4 files changed +28
-21
lines changed
Expand file tree Collapse file tree 4 files changed +28
-21
lines changed Original file line number Diff line number Diff line change 3030
3131# Import machine and rp2 for I2C and PIO.
3232import machine
33+ from machine import Pin
3334import rp2
3435i2c = machine .I2C ()
3536rp2 .PIO (1 ).gpio_base (16 )
6162 spi = machine .SPI (
6263 baudrate = 24_000_000 ,
6364 ),
64- pin_dc = 20 ,
65- pin_cs = 21 ,
65+ pin_dc = Pin . board . DISPLAY_DC ,
66+ pin_cs = Pin . board . DISPLAY_CS ,
6667)
6768driver_display = rv .displays .ST7789 (
6869 interface = interface_display ,
7879# color format.
7980interface_camera = rv .cameras .DVP_RP2_PIO (
8081 sm_id = 5 ,
81- pin_d0 = 28 ,
82- pin_vsync = 42 ,
83- pin_hsync = 41 ,
84- pin_pclk = 40 ,
85- pin_xclk = 44 , # Specify the XCLK pin if needed by your camera .
82+ pin_d0 = Pin . board . CAMERA_D0 ,
83+ pin_vsync = Pin . board . CAMERA_VSYNC ,
84+ pin_hsync = Pin . board . CAMERA_HSYNC ,
85+ pin_pclk = Pin . board . CAMERA_PCLK ,
86+ pin_xclk = Pin . board . CAMERA_XCLK , # Specify the XCLK pin if needed.
8687)
8788driver_camera = rv .cameras .OV5640 (
8889 interface = interface_camera ,
Original file line number Diff line number Diff line change 1515# Import the Red Vision package.
1616import red_vision as rv
1717
18+ # Import the Pin class for the board's default pins.
19+ from machine import Pin
20+
1821################################################################################
1922# DVP Camera
2023################################################################################
2932# PIO interface, only available on Raspberry Pi RP2 processors.
3033interface = rv .cameras .DVP_RP2_PIO (
3134 sm_id = 5 ,
32- pin_d0 = 28 ,
33- pin_vsync = 42 ,
34- pin_hsync = 41 ,
35- pin_pclk = 40 ,
35+ pin_d0 = Pin . board . CAMERA_D0 ,
36+ pin_vsync = Pin . board . CAMERA_VSYNC ,
37+ pin_hsync = Pin . board . CAMERA_HSYNC ,
38+ pin_pclk = Pin . board . CAMERA_PCLK ,
3639
3740 # Optionally specify the XCLK pin if needed by your camera.
38- pin_xclk = 44 ,
41+ # pin_xclk = Pin.board.CAMERA_XCLK ,
3942)
4043
4144##########
Original file line number Diff line number Diff line change 1515# Import the Red Vision package.
1616import red_vision as rv
1717
18+ # Import the Pin class for the board's default pins.
19+ from machine import Pin
20+
1821################################################################################
1922# SPI Display
2023################################################################################
3033# the fastest option (24Mbps on RP2350).
3134interface = rv .displays .SPI_Generic (
3235 spi = spi ,
33- pin_dc = 20 ,
34- pin_cs = 21 ,
36+ pin_dc = Pin . board . DISPLAY_DC ,
37+ pin_cs = Pin . board . DISPLAY_CS ,
3538)
3639
3740# PIO interface. This is only available on Raspberry Pi RP2 processors,
3841# but is much faster than the SPI interface (75Mbps on RP2350).
3942# interface = rv.displays.SPI_RP2_PIO(
4043# sm_id = 4,
41- # pin_clk = 22 ,
42- # pin_tx = 23 ,
43- # pin_dc = 20 ,
44- # pin_cs = 21 ,
44+ # pin_clk = Pin.board.DISPLAY_CLK ,
45+ # pin_tx = Pin.board.DISPLAY_TX ,
46+ # pin_dc = Pin.board.DISPLAY_DC ,
47+ # pin_cs = Pin.board.DISPLAY_CS ,
4548# )
4649
4750##########
Original file line number Diff line number Diff line change 1111# specific board and configuration.
1212#-------------------------------------------------------------------------------
1313
14- # Import the Pin class for the chip select pin
14+ # Import the Pin class for the board's default pins.
1515from machine import Pin
1616
1717# Import the SPI bus
2525spi_str = str (spi )
2626baudrate = int (spi_str [spi_str .index ("baudrate=" ) + 9 :].partition ("," )[0 ])
2727
28- # Set the chip select pin for the SD card
29- sd_cs = Pin (7 , Pin .OUT )
28+ # Set the chip select pin for the SD card.
29+ sd_cs = Pin (Pin . board . SD_CS , Pin .OUT )
3030
3131try :
3232 # Import the SD card module. This is often not installed by default in
You can’t perform that action at this time.
0 commit comments