#ifndef MINI212G2_H_ #define MINI212G2_H_ #include "ch32v30x.h" /* Set to 1 to enable UART commands to configure sensor at boot. * Set to 0 if sensor is pre-configured via USB to auto-output CMOS/DVP. * NOTE: PA2/PA3 may conflict with Ethernet — keep 0 unless UART is wired. */ #define SENSOR_UART_ENABLE 0 /* Sensor UART: USART2 PA2=TX PA3=RX */ #define SENSOR_UART USART2 #define SENSOR_UART_BAUD 115200 /** * Initialize sensor. When SENSOR_UART_ENABLE=1, configures via UART. * When SENSOR_UART_ENABLE=0, assumes sensor is pre-configured via USB. * Call BEFORE DVP_Init(). Returns 0 on success. */ int Mini212G2_Init(void); #if SENSOR_UART_ENABLE /** * Send a raw protocol command and wait for ACK. * Returns 0 on ACK received, -1 on timeout/bad response. */ int Mini212G2_SendCmd(const uint8_t *cmd, uint8_t len); /** * Query current digital video settings. Prints result to debug console. */ void Mini212G2_PrintDigitalVideoStatus(void); /** * Trigger shutter compensation (NUC). */ int Mini212G2_ShutterCompensation(void); #endif /* SENSOR_UART_ENABLE */ #endif