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

oIR Class Reference

Controls a Sharp GP2Y0A02YK, GP2D12, and GP2D120IR IR module. More...

#include <oir.h>

Inheritance diagram for oIR:

oA2D OOMRM oTPU

Public Member Functions

 oIR (IOLINE channel, IR_TYPE type)
void callibrate (short c)
short value (void)
int value (void) const
 Digital value on channel.

void operate (bool b)
 True starts A2D; otherwise 0 on channel.


Static Public Member Functions

int TCR1 (void)
void TMCR (int iarb)
bool HSQR (int chan, int val)
 Configures the host sequence register.

bool HSRR (int chan, int val)
 Configures the host sequence request register.

bool CPR (int chan, int val)
 Configures the channel priority register (Ref. TPU Channel Utilization).

bool CIER (int chan, int cie)
 Configures the channel interrupt enable register.

int CISR (int chan)
 Returns the channel interrupt status register.

void CISR_clear (int chan)
 Clears the channel interrupt status register for the channel.

bool TICR (int cirl, int cibv)
 Configures the TPU interrupt configuration register.

int tpu_vector (IOLINE channel)
 Given a channel, returns the vector number to use for an interrupt.


Detailed Description

Controls a Sharp GP2Y0A02YK, GP2D12, and GP2D120IR IR module.

Operation
This is an object based upon the oA2D object to detect distance an IR's reference function. Ref. oA2D for associated problems. The internal table begins at 8 cm. and farther out has big jumps as its to hard to be accurate toward the outer region.
Remarks
Be careful, as sometimes there might be noisy regions. On my GP2D12, the range inbween 50-60 centimeters is sometimes not very reliable and sometimes returns values closer. Of course, this is a sensor issue and not an implementation issue. Supported IR types are:
Sample Code
#include <hardware/oir.h>
int main()
{
oIR ir(0,GP12D2);       // channel 0 of A2D port.
  ir.callibrate(0);     // appearing too close
  while (ir.value() < 40)
  {
    // .. do something useful
  }
}


Constructor & Destructor Documentation

oIR IOLINE  channel,
IR_TYPE  type
 

Constructor specifying channel on A2D PORT. Callibrate factor needed for each sensor.


Member Function Documentation

void callibrate short  c  ) 
 

Note: A larger callibration number will decrease distance returned. The default is:

  • GP2Y0A02YK: 10
  • GP2D12: 3
  • GP2D120: 1

bool CIER int  chan,
int  cie
[static, inherited]
 

Configures the channel interrupt enable register.

Parameters:
int: channel
int: 1 enables; 0 disables

bool CPR int  chan,
int  val
[static, inherited]
 

Configures the channel priority register (Ref. TPU Channel Utilization).

Parameters:
int: channel
int: priority

bool HSQR int  chan,
int  val
[static, inherited]
 

Configures the host sequence register.

Parameters:
int: channel
int dependent upon function (CFSR) selected

bool HSRR int  chan,
int  val
[static, inherited]
 

Configures the host sequence request register.

Parameters:
int: channel
int: dependend upon function

int TCR1 void   )  [static, inherited]
 

misnomer--should be TCR1 divisor--return number of clocks (PSCK,TCR1P modifications) Globally available object. Can be used in combination with TPU_REGISTER definition to say TPU_REGISTER->CFSR.BITS...

void TMCR int  iarb  )  [static, inherited]
 

was tpu_init Configures the channel function select register

short value void   ) 
 

Distance from object in millimeterss. Set status of component


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