![]() |
PicoCamera 0.2.0
Camera library for RP2040 with an esp32-camera compatible API
|
GitHub |
Shared SCCB (I2C) access layer. More...
#include <stdint.h>Go to the source code of this file.
Functions | |
| int | sccb_init (int i2c_port, int pin_sda, int pin_scl, uint32_t freq_hz) |
| Initialize the SCCB bus. | |
| void | sccb_deinit (void) |
| int | sccb_write8 (uint8_t slave_addr, uint8_t reg, uint8_t value) |
| int | sccb_read8 (uint8_t slave_addr, uint8_t reg, uint8_t *value) |
| int | sccb_write16 (uint8_t slave_addr, uint16_t reg, uint8_t value) |
| int | sccb_read16 (uint8_t slave_addr, uint16_t reg, uint8_t *value) |
| void | sccb_write_list8 (uint8_t slave_addr, const uint8_t(*regs)[2]) |
| void | sccb_write_list16 (uint8_t slave_addr, const uint16_t(*regs)[2]) |
Shared SCCB (I2C) access layer.
Sensors differ in register address width (OV2640: 8-bit, OV3660: 16-bit); both variants are provided here so sensor modules stay pure register logic.
| void sccb_deinit | ( | void | ) |
Release the SCCB bus. A shared bus (pin_sda == -1) is left untouched.
| int sccb_init | ( | int | i2c_port, |
| int | pin_sda, | ||
| int | pin_scl, | ||
| uint32_t | freq_hz ) |
Initialize the SCCB bus.
| i2c_port | RP2040 I2C peripheral number: 0 or 1 |
| pin_sda | SDA GPIO, or -1 to reuse an already initialized I2C bus (esp32-camera parity); the caller must have set up the bus beforehand and keeps owning it. Real pins are hard-muxed: SDA must be an even GPIO routing to the requested port, i.e. (pin / 2) % 2 == i2c_port |
| pin_scl | SCL GPIO (ignored when pin_sda is -1) |
| freq_hz | Bus frequency (100000 is a safe default) |
| int sccb_write16 | ( | uint8_t | slave_addr, |
| uint16_t | reg, | ||
| uint8_t | value ) |
16-bit register address access (e.g. OV3660). Return 0 on success.
| int sccb_write8 | ( | uint8_t | slave_addr, |
| uint8_t | reg, | ||
| uint8_t | value ) |
8-bit register address access (e.g. OV2640). Return 0 on success.
| void sccb_write_list16 | ( | uint8_t | slave_addr, |
| const uint16_t(*) | regs[2] ) |
Write a {reg, value} list terminated by reg == 0xFFFF (16-bit addresses). reg == 0xFFFE is a delay marker, value gives milliseconds.
| void sccb_write_list8 | ( | uint8_t | slave_addr, |
| const uint8_t(*) | regs[2] ) |
Write a {reg, value} list terminated by {0xFF, 0xFF} (8-bit addresses).