PikeAero::CSPIAmp Class Reference

#include <cspiamp.h>

Inheritance diagram for PikeAero::CSPIAmp:

Inheritance graph
[legend]
Collaboration diagram for PikeAero::CSPIAmp:

Collaboration graph
[legend]

Public Member Functions

 CSPIAmp ()
void setChanelGain (CMachine::ubit8 channel, CMachine::ubit8 gain)
 set channel and gain
void setChannel (CMachine::ubit8 channel)
 select channel.
void setGain (CMachine::ubit8 gain)
 set gain.
virtual ~CSPIAmp ()

Private Member Functions

void functionEnter ()
void functionExit ()

Detailed Description

Communicates with Microchip MCP6S28 op-amp multiplexer on BSPI2. Chip Select P6.2 selects 25LC1024 EEPROM IC. Chip Select P6.3 selects MCP6S28 op-amp IC.

Author:
Michael Sharkey <mike@pikeaero.com>

Definition at line 35 of file cspiamp.h.


Constructor & Destructor Documentation

PikeAero::CSPIAmp::CSPIAmp (  ) 

BSPI2 @ 5.333 MHz

Definition at line 27 of file cspiamp.cpp.

00028 : inherited(BSPI2) /** BSPI2 @ 5.333 MHz */
00029 {
00030 }

PikeAero::CSPIAmp::~CSPIAmp (  )  [virtual]

Definition at line 33 of file cspiamp.cpp.

00034 {
00035 }


Member Function Documentation

void PikeAero::CSPIAmp::functionEnter (  )  [private]

Activate chip select

disable 25LC1024 CS

enable MCP6S28 CS

Definition at line 37 of file cspiamp.cpp.

References PikeAero::CSPI::disableChipSelect(), PikeAero::CSPI::disableRXInterrupts(), PikeAero::CSPI::disableTXInterrupts(), PikeAero::CSPI::enableChipSelect(), GPIO_PIN_2, and GPIO_PIN_3.

Referenced by setChanelGain(), setChannel(), and setGain().

00038 {
00039     disableRXInterrupts();
00040     disableTXInterrupts();
00041 
00042     /** Activate chip select */
00043     disableChipSelect( GPIO_PIN_2 );    /** disable 25LC1024 CS */
00044     enableChipSelect( GPIO_PIN_3 );     /** enable MCP6S28 CS */
00045 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CSPIAmp::functionExit (  )  [private]

Deactivate chip select

disable MCP6S28 CS

Definition at line 47 of file cspiamp.cpp.

References PikeAero::CSPI::disableChipSelect(), and GPIO_PIN_3.

Referenced by setChanelGain(), setChannel(), and setGain().

00048 {
00049     /** Deactivate chip select */
00050     disableChipSelect( GPIO_PIN_3 );    /** disable MCP6S28 CS */
00051 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CSPIAmp::setChanelGain ( CMachine::ubit8  channel,
CMachine::ubit8  gain 
)

set channel and gain

address the channel register

select the channel

address the gain register

set the channel gain

Definition at line 56 of file cspiamp.cpp.

References PikeAero::CSPI::clearReceiver(), functionEnter(), functionExit(), PikeAero::CMachine::mutexBSPI2(), and PikeAero::CSPI::tx().

00057 {
00058     CMutexLock mutexLock( CMachine::mutexBSPI2() );
00059     functionEnter();
00060     
00061     tx( 0x41 );             /** address the channel register */
00062     tx( channel & 0x07 );   /** select the channel */
00063     
00064     tx( 0x40 );             /** address the gain register */
00065     tx( gain & 0x07 );      /** set the channel gain */
00066     
00067     clearReceiver();
00068     functionExit();
00069 }   

Here is the call graph for this function:

void PikeAero::CSPIAmp::setChannel ( CMachine::ubit8  channel  ) 

select channel.

address the channel register

select the channel

Definition at line 74 of file cspiamp.cpp.

References PikeAero::CSPI::clearReceiver(), functionEnter(), functionExit(), PikeAero::CMachine::mutexBSPI2(), and PikeAero::CSPI::tx().

00075 {
00076     CMutexLock mutexLock( CMachine::mutexBSPI2() );
00077     functionEnter();
00078     
00079     tx( 0x41 );             /** address the channel register */
00080     tx( channel & 0x07 );   /** select the channel */
00081     
00082     clearReceiver();
00083     functionExit();
00084 }

Here is the call graph for this function:

void PikeAero::CSPIAmp::setGain ( CMachine::ubit8  gain  ) 

set gain.

address gain register

set the channel gain

Definition at line 89 of file cspiamp.cpp.

References PikeAero::CSPI::clearReceiver(), functionEnter(), functionExit(), PikeAero::CMachine::mutexBSPI2(), and PikeAero::CSPI::tx().

00090 {
00091     CMutexLock mutexLock( CMachine::mutexBSPI2() );
00092     functionEnter();
00093     
00094     tx( 0x40 );             /** address gain register */
00095     tx( gain & 0x07 );      /** set the channel gain */
00096     
00097     clearReceiver();
00098     functionExit();
00099 }

Here is the call graph for this function:


The documentation for this class was generated from the following files:

Generated on Sun Oct 25 14:00:15 2009 for stingray3 by  doxygen 1.5.8