adafruit_ov7670
¶
CircuitPython driver for OV7670 cameras
Author(s): Jeff Epler
Implementation Notes¶
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
The CircuitPython build for your board must support the
imagecapture
module.Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_ov7670.OV7670(i2c_bus, data_pins, clock, vsync, href, shutdown=None, reset=None, mclk=None, mclk_frequency=16000000, i2c_address=33)¶
Library for the OV7670 digital camera
- Parameters
i2c_bus (busio.I2C) – The I2C bus used to configure the OV7670
data_pins (List[microcontroller.Pin]) – A list of 8 data pins, in order.
clock (microcontroller.Pin) – The pixel clock from the OV7670.
vsync (microcontroller.Pin) – The vsync signal from the OV7670.
href (microcontroller.Pin) – The href signal from the OV7670, sometimes inaccurately called hsync.
shutdown (Optional[microcontroller.Pin]) – If not None, the shutdown signal to the camera, also called the powerdown or enable pin.
reset (Optional[microcontroller.Pin]) – If not None, the reset signal to the camera.
mclk (Optional[microcontroller.Pin]) – The pin on which to create a master clock signal, or None if the master clock signal is already being generated.
mclk_frequency (int) – The frequency of the master clock to generate, ignored if mclk is None, requred if it is specified
i2c_address (int) – The I2C address of the camera.
- capture(buf)¶
Capture an image into the buffer.
- Parameters
buf (Union[bytearray, memoryview]) – A WritableBuffer to contain the captured image. Note that this can be a ulab array or a displayio Bitmap.
- property colorspace¶
Get or set the colorspace, one of the
OV7670_COLOR_
constants.
- deinit()¶
Deinitialize the camera
- property flip_x¶
Get or set the X-flip flag
- property flip_y¶
Get or set the Y-flip flag
- property height¶
Get the image height in pixels. A buffer of 2*width*height bytes stores a whole image.
- property mclk_frequency¶
Get the actual frequency the generated mclk, or None
- property night¶
Get or set the night-vision mode, one of the
OV7670_NIGHT_MODE_
constants.
- property product_id¶
Get the product id (PID) register. The expected value is 0x76.
- property product_version¶
Get the version (VER) register. The expected value is 0x73.
- property size¶
Get or set the captured image size, one of the
OV7670_SIZE_
constants.
- property test_pattern¶
Get or set the test pattern, one of the
OV7670_TES_PATTERN_
constants.
- property width¶
Get the image width in pixels. A buffer of 2*width*height bytes stores a whole image.
- adafruit_ov7670.OV7670_ADDR = 33¶
Default I2C address if unspecified
- adafruit_ov7670.OV7670_COLOR_RGB = 0¶
RGB565 big-endian
- adafruit_ov7670.OV7670_COLOR_YUV = 1¶
YUV/YCbCr 422 big-endian
- adafruit_ov7670.OV7670_NIGHT_MODE_2 = 160¶
Night mode 1/2 frame rate
- adafruit_ov7670.OV7670_NIGHT_MODE_4 = 192¶
Night mode 1/4 frame rate
- adafruit_ov7670.OV7670_NIGHT_MODE_8 = 224¶
Night mode 1/8 frame rate
- adafruit_ov7670.OV7670_NIGHT_MODE_OFF = 0¶
Disable night mode
- adafruit_ov7670.OV7670_SIZE_DIV1 = 0¶
640 x 480
- adafruit_ov7670.OV7670_SIZE_DIV16 = 4¶
40 x 30
- adafruit_ov7670.OV7670_SIZE_DIV2 = 1¶
320 x 240
- adafruit_ov7670.OV7670_SIZE_DIV4 = 2¶
160 x 120
- adafruit_ov7670.OV7670_SIZE_DIV8 = 3¶
80 x 60
- adafruit_ov7670.OV7670_TEST_PATTERN_COLOR_BAR = 2¶
8 color bars
- adafruit_ov7670.OV7670_TEST_PATTERN_COLOR_BAR_FADE = 3¶
Color bars w/fade to white
- adafruit_ov7670.OV7670_TEST_PATTERN_NONE = 0¶
Normal operation mode (no test pattern)
- adafruit_ov7670.OV7670_TEST_PATTERN_SHIFTING_1 = 1¶
“Shifting 1” pattern