![]() |
PicoCamera 0.2.0
Camera library for RP2040 with an esp32-camera compatible API
|
GitHub |
PIO + DMA frame capture engine. 更多...
#include <stddef.h>#include <stdint.h>结构体 | |
| struct | pio_capture_pins_t |
函数 | |
| int | pio_capture_init (const pio_capture_pins_t *pins) |
| Claim a PIO state machine and DMA channel, load the capture program. | |
| void | pio_capture_deinit (void) |
| int | pio_capture_frame (uint8_t *buf, size_t len, uint32_t timeout_ms) |
| Capture exactly len bytes (one frame) into buf, blocking. | |
| int | pio_capture_frame_variable (uint8_t *buf, size_t capacity, size_t *out_len, uint32_t timeout_ms) |
| Capture one variable-length frame (JPEG) into buf. | |
PIO + DMA frame capture engine.
The PIO program is assembled at runtime with pio_encode_*(), so all pins come from camera_config_t - there is no .pio file and no pioasm build step (which also keeps the library Arduino-IDE friendly).
| void pio_capture_deinit | ( | void | ) |
Release PIO state machine and DMA channel.
| int pio_capture_frame | ( | uint8_t * | buf, |
| size_t | len, | ||
| uint32_t | timeout_ms ) |
Capture exactly len bytes (one frame) into buf, blocking.
Waits for the next VSYNC rising edge, then captures while HREF is high, clocked by PCLK, until len bytes are in the buffer.
| timeout_ms | abort and return PICO timeout error after this long |
| int pio_capture_frame_variable | ( | uint8_t * | buf, |
| size_t | capacity, | ||
| size_t * | out_len, | ||
| uint32_t | timeout_ms ) |
Capture one variable-length frame (JPEG) into buf.
Uses the continuous capture program: streams from a VSYNC rising edge until VSYNC falls again (frame end), then trims the buffer at the JPEG EOI marker (0xFFD9).
| buf | destination buffer |
| capacity | buffer capacity in bytes; a frame larger than this is truncated |
| out_len | receives the actual frame length in bytes |
| timeout_ms | abort and return error after this long |
| int pio_capture_init | ( | const pio_capture_pins_t * | pins | ) |
Claim a PIO state machine and DMA channel, load the capture program.