Main Page   Hardware Class Hierarchy   Hardware API     Mapping Class Hierarchy  Mapping API 

oCameraGB Class Reference

An object to control a GameBoy Camera. More...

#include <ocameragb.h>


Public Member Functions

 oCameraGB (IOLINE, PORT, IOLINE, IOLINE, IOLINE, IOLINE, IOLINE, IOLINE, uint8 subclass=0)

Static Public Member Functions

word exposure (void)
 Automatically set exposure.

int exposure (MICROSECOND)
 Set exposure. (returns C register for debugging).

void reset (void)
 Call gbcam_init to reset after chaning parameters.

void invert (bool)
void gain (uint8 b)
 Sets the image gain. (5 bits).

void shoot (void)
 Takes a picture.

uint8 status (void)
 Returns the current state of the top level component.

void status (uint8 s)
 Set the status of the component.


Protected Attributes

uint8 _status
 JAUS status (visual sensor component).


Detailed Description

An object to control a GameBoy Camera.

Gameboy Camera
The Gameboy camera has an effective resolution of 128 pixels across by 123 pixels vertically. At the heart of the GAME BOY® Camera is the M64282FP CMOS image sensor from Mitsubishi
Warning:
Only works with ROM loaded programs (library default); I need to streamline the loader scripts (RAM/ROM) to work with the camera.
Operation
The CameraGB uses Dafydd Walter's code to control the Gameboy Camera. The code has been modified to allow dynamic control of the control pins. But Dafydd reminds us to be aware that certain pins have a special purpose during reset, so for example, it is not possible to use Port F, bit 0 as an input (e.g. for the camera READ signal) since it is the MODCLK configuration pin of the 68332.
Also be aware that this code allows ONLY one camera to be hooked up currently. For details on how to hook up the camera refer to Implementing Vision Using a GAME BOY Camera on the MRM currently at Seattle Robotics Society's web site. The pin assignements in paranthesis refer to Dafydd's wire table (table 1. Eyeball to MRM connections). Use this as a guide.
The view method can be controlled manually, but preferred is to use the GBCamView Java script that allows you to interact with the camera. Refer to the above Seattle Robotics Society'S page for details.
Remarks
To allow generic pin assignments required the "setting aside" of memory. This allows the C++/C/Assembly to communicate. To accomplish this I simply changed the _ram_start location. This currently only works in the ROM loader script. I need to do more testing to find an acceptable global allocation scheme that works in both RAM/ROM.
Note, see Analysis of the Gameboy Camera Frame Rate for notes on maximizing the frame rate.
Debugging Hints
Always be sure you have the programming cable connected. Connected to terminal do the following:
Sample Code
#include <hardware/ocameragb.h>
#include <hardware/oled.h>
#include <oconsole.h>
int EXPOSURE_TIME =6000;
char RXbuff[251];
char TXbuff[251];
oConsole console;
oCameraGB GB(0,PORT_F,3,5,7,6,4,2);     // Gameboy camera mounted facing down in front of robot.
oGreenLED green;
int main()
{
  green.on();
  console.buffer(&RXbuff[0],250,&TXbuff[0],250);
  console.syncronize();
  GB.exposure(EXPOSURE_TIME);   // set exposure 24000 is about 2 frame/sec; 7000 is about 5-6/second(?)
  GB.view();    // interactive mode.
  exit(0);
}
:

:


Constructor & Destructor Documentation

oCameraGB IOLINE  ,
PORT  ,
IOLINE  ,
IOLINE  ,
IOLINE  ,
IOLINE  ,
IOLINE  ,
IOLINE  ,
uint8  subclass = 0
 

Parameters:
IOLINE: Vout - Analog Signal Output on A2D port (8).
PORT: CamPort - The port the camera is attached (E/F).
IOLINE: CamREAD - Channel to read image output (7).
IOLINE: CamXCK - Channel for system clock input (6).
IOLINE: CamXRST - Channel for system reset input (5).
IOLINE: CamLOAD - Channel for data set input (4).
IOLINE: CamSIN - Channel for data input (3).
IOLINE: CamSTRT - Channel for start input (2).


Member Function Documentation

void invert bool   )  [static]
 

Inverts the image if true (negative). Sets the edge extraction mode.


The documentation for this class was generated from the following file:
Generated on Mon Oct 8 19:32:45 2007 for OOMRM Hardware API by doxygen1.3