Main Page | Modules | Data Structures | File List | Data Fields | Globals

gbcam.h File Reference

Image capture functions for the MRM. More...

#include <68332/types.h>

Go to the source code of this file.

Data Structures

struct  _gbcam_RegistersType

Defines

#define gbcam_IMAGE_WIDTH   128
#define gbcam_IMAGE_HEIGHT   123
#define gbcam_IMAGE_SIZE   (gbcam_IMAGE_WIDTH * gbcam_IMAGE_HEIGHT)

Typedefs

typedef _gbcam_RegistersType gbcam_RegistersType

Functions

void gbcam_init (void)
void gbcam_exposure (void)
void gbcam_shoot (void)

Variables

uint8 gbcam_imageBuffer [gbcam_IMAGE_SIZE]
gbcam_RegistersType gbcam_registers


Detailed Description

This file contains the global function prototypes, constants and data structures for libgbcam, the Game Boy Camera library.

For a detailed article describing how to connect a Game Boy Camera to the MRM, please refer to the web page http://www.seattlerobotics.org/encoder/200205/gbcam.html

To use the functions defined in this file, include <68332/mrm/gbcam.h> and link libgbcam.a.


Define Documentation

#define gbcam_IMAGE_WIDTH   128
 

#define gbcam_IMAGE_HEIGHT   123
 

#define gbcam_IMAGE_SIZE   (gbcam_IMAGE_WIDTH * gbcam_IMAGE_HEIGHT)
 


Typedef Documentation

typedef struct _gbcam_RegistersType gbcam_RegistersType
 

This typedef provides a convenient alias for the structure struct _gbcam_RegistersType, an 8-byte structure holds the register values of the Mitsubishi M64282FP Artificial Retina camera chip. See the M64282FP data sheet for more details. A link to download the data sheet is available from the on-line Encoder article at http://www.seattlerobotics.org/encoder/200205/gbcam.html


Function Documentation

void gbcam_init void   ) 
 

Initializes the I/O. Needs to be called once.

void gbcam_exposure void   ) 
 

Sets the exposure time automatically by metering the image brightness several times using a binary-search algorithm to maximize the mean deviation of the pixel intensity values. Call this before calling gbcam_shoot(). If you need to adjust any of the M64282FP's registers, change the members of gbcam_registers prior to calling this function. This function overwrites the value of member C in the gbcam_registers structure.

void gbcam_shoot void   ) 
 

Takes a picture and stores the image in the byte array gbcam_imageBuffer.


Variable Documentation

uint8 gbcam_imageBuffer[gbcam_IMAGE_SIZE]
 

gbcam_imageBuffer is the image capture buffer, which holds the pixel values (one byte per pixel) after calling gbcam_shoot().

gbcam_RegistersType gbcam_registers
 

The values in gbcam_registers can be tweaked directly, if necessary, prior to calling gbcam_exposure() or gbcam_shoot(). The defaults should work fine for simple image-capture applications.

The default values of the registers are as follows:

  • O = 0
  • Z = 0
  • G = 4
  • VH = 0
  • N = 0
  • C = 0xAFF : this value is overwritten by gbcam_exposure()
  • P = 1
  • M = 0
  • X = 1
  • V = 7
  • I = 0
  • E = 0

Note that the above bitfield is compiler dependent (designed for GNU m68k toolchain) and the defaults above correspond to the following memory map:

.byte 0x00 ; Z1-Z0, O5-O0
.byte 0x04 ; N, VH1-VH0, G4-G0
.byte 0x0A ; C17-C10
.byte 0xFF ; C07-C00
.byte 0x01 ; P7-P0
.byte 0x00 ; M7-M0
.byte 0x01 ; X7-X0
.byte 0x07 ; E3-E0, I, V2-V0


Generated on Wed Sep 6 03:02:22 2006 for MotoRobots by doxygen 1.3.6