@@ -38,25 +38,22 @@ def __init__(
3838 Initializes the DVP interface with the specified parameters.
3939
4040 Args:
41+ sm_id (int): PIO state machine ID
4142 pin_d0 (int): Data 0 pin number for DVP interface
4243 pin_vsync (int): Vertical sync pin number
4344 pin_hsync (int): Horizontal sync pin number
4445 pin_pclk (int): Pixel clock pin number
45- pin_xclk (int): External clock pin number
46- xclk_freq (int): Frequency in Hz for the external clock
47- sm_id (int): PIO state machine ID
48- num_data_pins (int): Number of data pins used in DVP interface
49- bytes_per_pixel (int): Number of bytes per pixel
50- byte_swap (bool): Whether to swap bytes in the captured data
51- continuous (bool): Whether to continuously capture frames
46+ pin_xclk (int, optional): External clock pin number
5247 """
48+ # Store state machine ID
49+ self ._sm_id = sm_id
50+
5351 # Store pin assignments
5452 self ._pin_d0 = pin_d0
5553 self ._pin_vsync = pin_vsync
5654 self ._pin_hsync = pin_hsync
5755 self ._pin_pclk = pin_pclk
5856 self ._pin_xclk = pin_xclk
59- self ._sm_id = sm_id
6057
6158 def begin (
6259 self ,
@@ -66,6 +63,18 @@ def begin(
6663 byte_swap ,
6764 continuous = False ,
6865 ):
66+ """
67+ Begins the DVP interface with the specified parameters.
68+
69+ Args:
70+ buffer (ndarray): Image buffer to write captured frames into
71+ xclk_freq (int): Frequency in Hz for the XCLK pin, if it is used
72+ num_data_pins (int): Number of data pins used by the camera (1 to 8)
73+ byte_swap (bool): Whether to swap bytes in each pixel
74+ continuous (bool, optional): Whether to continuously capture frames
75+ (default: False)
76+ """
77+ # Store buffer and its dimensions
6978 self ._buffer = buffer
7079 self ._height , self ._width , self ._bytes_per_pixel = buffer .shape
7180
@@ -108,14 +117,17 @@ def begin(
108117
109118 def buffer (self ):
110119 """
111- Returns the current frame buffer from the camera .
120+ Returns the current frame buffer used by this driver .
112121
113122 Returns:
114123 ndarray: Frame buffer
115124 """
116125 return self ._buffer
117126
118127 def _setup_pio (self ):
128+ """
129+ Sets up the PIO state machine for the DVP interface.
130+ """
119131 # Copy the PIO program
120132 program = self ._pio_read_dvp
121133
@@ -505,6 +517,9 @@ def _assemble_control_blocks(self):
505517 def _add_control_block (self , block ):
506518 """
507519 Helper function to add a control block to the control block array.
520+
521+ Args:
522+ block (array): Control block to add
508523 """
509524 # Add the control block to the array. Each control block is all 4 DMA
510525 # alias 0 registers in order.
0 commit comments