diff --git a/src/omv/ports/rp2/dcmi.pio b/src/omv/ports/rp2/dcmi.pio index af42c0fcd..09c2af4cf 100644 --- a/src/omv/ports/rp2/dcmi.pio +++ b/src/omv/ports/rp2/dcmi.pio @@ -19,17 +19,17 @@ wait 1 gpio VSYNC ; Wait for VSYNC to go low wait 0 gpio VSYNC -line_loop: +HSYNC_LOOP: mov x, osr ; Copy line width from OSR to X wait 0 gpio HSYNC ; Wait for HSYNC to go high wait 1 gpio HSYNC -pixels_loop: +PIXEL_LOOP: wait 0 gpio PXCLK wait 1 gpio PXCLK in pins 8 - jmp x-- pixels_loop ; Keep reading pixels while x != 0 - jmp y-- line_loop ; Keep reading lines while y != 0 + jmp x-- PIXEL_LOOP ; Keep reading pixels while x != 0 + jmp y-- HSYNC_LOOP ; Keep reading lines while y != 0 .wrap .program dcmi_odd_byte @@ -41,17 +41,48 @@ pixels_loop: wait 1 gpio VSYNC ; Wait for VSYNC to go low wait 0 gpio VSYNC -line_loop: +HSYNC_LOOP: mov x, osr ; Copy line width from OSR to X wait 0 gpio HSYNC ; Wait for HSYNC to go high wait 1 gpio HSYNC -pixels_loop: +PIXEL_LOOP: wait 0 gpio PXCLK wait 1 gpio PXCLK in pins 8 wait 0 gpio PXCLK wait 1 gpio PXCLK - jmp x-- pixels_loop ; Keep reading pixels while x != 0 - jmp y-- line_loop ; Keep reading lines while y != 0 + jmp x-- PIXEL_LOOP ; Keep reading pixels while x != 0 + jmp y-- HSYNC_LOOP ; Keep reading lines while y != 0 .wrap + +% c-sdk { +static inline int dcmi_config(uint32_t pixformat) +{ + uint offset; + pio_sm_config config; + + pio_sm_set_enabled(DCMI_PIO, DCMI_SM, false); + pio_sm_clear_fifos(DCMI_PIO, DCMI_SM); + + for(uint i=DCMI_D0_PIN; i