- Main Page
- Modules
- Data Structures
- Files
- Directories

# Camera slow three timers

## Files
file | e_calc.c
| Calculate the timing for the camera (three timers).

file | e_po3030k.h
| PO3030k library header (three timers).

file | e_registers.c
| Manage po3030k registers (three timers).

file | e_timers.c
| Manage camera's interrupts (three timers).

## Detailed Description

Warning:
  This driver version is completly interrupt driven to syncronize with the camera. This slow down the acquisition a lot. You should use the other driver's version which syncronize with the camera only at each row.

## Introduction

This driver expose most of the Po3030k camera interfaces. Some functions are usefull, some other not. But since this is not up to the driver to decide if a function is needed, I've exported almost all.

The architecture is quite simple. The driver keep a array where every known camera register is keept in memory. The configuration function only alter this array. When you call, for exemple e_po3030k_config_cam(), nothing is written on the camera, but only in the internal register representation.

To effectively write the register, you must call e_po3030k_write_cam_registers(). This is typically done after every configuration call and before acquire the first picture.

## Default settings

The camera is, by default, configured with the followin settings:

- Automatic white balance control
- Automatic exposure control
- Automatic flicker detection ( 50Hz and 60Hz )

There is no default setting for the image size and color.

## Performances

The maximum framerate ( without doing anything else than acquiring the picture ) vary with the subsampling and the color mode. Here are some framerates. Please use the other driver to have better performances :

- Size: 640x480, Subsampling: 16x16, RGB565: 0.6 fps
- Size: 64x64, Subsampling: 4x4, RGB565: 0.6 fps
- Size: 32x32, Subsampling: 2x2, RGB565: 0.3 fps
- Size: 16x16, No Subsampling, RGB565: 0.2 fps
- Size: 640x480, Subsampling: 16x16, GREYSCALE: 1.1 fps
- Size: 64x64, Subsampling: 4x4, GREYSCALE: 1.1 fps
- Size: 32x32, Subsampling: 2x2, GREYSCALE: 0.6 fps
- Size: 16x16, No subsampling, GREYSCALE: 0.3 fps

## Exemples

### Basic example

    #include "e_po3030k.h"

    char buffer[2*40*40];
    int main(void) {

            e_po3030k_init_cam();
            e_po3030k_config_cam((ARRAY_WIDTH -160)/2,(ARRAY_HEIGHT-160)/2,
                             160,160,4,4,RGB_565_MODE);
            e_po3030k_write_cam_registers();

            e_po3030k_launch_capture(buffer);
            while(!e_po3030k_is_img_ready());

            // buffer contain a 40*40 RGB picture now
            ( insert usefull code here )

            return 0;
    }

This exemple tell de driver to aquire 160x160 pixel picture from the camera 4x subsampling, thus resulting with a 40x40 pixel. The buffer as a size of 40*40*2 because RGB565 is a two bytes per pixel data format.

### More advanced example

    #include "e_po3030k.h"

    char buffer[160*2];
    int main(void) {
            e_po3030k_init_cam();
            e_po3030k_config_cam((ARRAY_WIDTH - 320)/2,(ARRAY_HEIGHT - 32)/2,
                            320,8,2,4,GREY_SCALE_MODE);
            e_po3030k_set_mirror(1,1);
            e_po3030k_set_ref_exposure(100);

            e_po3030k_write_cam_registers();

            e_po3030k_launch_capture(buffer);
            while(!e_po3030k_is_img_ready());

            // Here buffer contain a 160x2 greyscale picture

            return 0;
    }

This exemple configure the camera to aquire a 320x8 pixel picture, but subsampled 2x in width and 4x in heigth, thus resulting in a 160*2 linear greyscale picture. It "emulate" a linear camera. This exemple tell the camera to to enable the vertical and horizontal mirror, and to set the average exposure to 100.