Skip to content

Commit 184df97

Browse files
committed
Update boot.py with camera driver refactor
1 parent bdb9fee commit 184df97

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

examples/boot.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,30 @@
9898
# a popular camera module for embedded systems. This example uses a PIO
9999
# driver, which is a peripheral interface only available on Raspberry Pi RP2
100100
# processors
101-
from cv2_drivers.cameras import hm01b0_pio
101+
import cv2_drivers.cameras as cameras
102102

103103
# Create a camera object. This will depend on the camera driver you are
104104
# using, and you may need to adjust the parameters based on your specific
105105
# camera and board configuration
106-
camera = hm01b0_pio.HM01B0_PIO(i2c,
107-
pin_d0=12,
108-
pin_vsync=13,
109-
pin_hsync=14,
110-
pin_pclk=15)
106+
camera = cameras.hm01b0_pio.HM01B0_PIO(
107+
i2c,
108+
pin_d0=12,
109+
pin_vsync=13,
110+
pin_hsync=14,
111+
pin_pclk=15,
112+
pin_xclk=None, # Optional xclock pin, specify if needed
113+
num_data_pins=1 # Number of data pins used by the camera (1, 4, or 8)
114+
)
115+
116+
# camera = cameras.ov5640_pio.OV5640_PIO(
117+
# i2c,
118+
# pin_d0=8,
119+
# pin_vsync=22,
120+
# pin_hsync=21,
121+
# pin_pclk=20,
122+
# pin_xclk=None # Optional xclock pin, specify if needed
123+
# )
111124
except ImportError:
112125
print("boot.py - Camera driver module not found, skipping camera initialization.")
126+
except OSError:
127+
print("boot.py - Camera initialization failed, skipping camera initialization.")

0 commit comments

Comments
 (0)