Crate arducam_mega

source ·
Expand description

arducam-mega

arducam-mega is an embedded-hal SPI driver for the Arducam Mega. This driver aims to provide access to all features of the camera. However, due to hardware access and time constraints, not all features and hardware variants have been actively tested. We welcome any and all contributions improving the support and quality of this library.

Examples

The following example shows how the camera could be used on an ESP32 using the SPI3 device.

let peripherals = Peripherals::take();
let clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze();
let delay = Delay::new(&clocks);

let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let sclk = io.pins.gpio18;
let miso = io.pins.gpio19;
let mosi = io.pins.gpio23;
let cs = io.pins.gpio5;

let spi_controller = SpiBusController::from_spi(Spi::new_no_cs(
    peripherals.SPI3,
    sclk,
    mosi,
    miso,
    8u32.MHz(),
    SpiMode::Mode0,
    &mut system.peripheral_clock_control,
    &clocks,
));

let spi_device_1 = spi_controller.add_device(cs);

let mut cam = ArducamMega::new(spi_device_1, delay);

cam.reset()?
    .set_format(Format::Jpeg)?
    .set_resolution(Resolution::Hd)?
    .set_white_balance_mode(WhiteBalanceMode::Home)?;

let length = cam
    .capture()?
    .read_fifo_length()?;

// assuming buf.len() == length
cam.read_fifo_full(buf)?;

Structs

Enums

  • Values to set the brightness bias of the camera
  • Represents the type of camera connected to the SPI bus
  • Values to set the color effect of the camera
  • The format in which the camera data should be formatted
  • Values to set the level of some configuration settings
  • The resolution of the image captured by the camera
  • Values to set the sharpness of the camera
  • The white balance mode the camera should use

Functions