QuadroCopter  0.1.4
quadro::analog::analogBase Class Reference

#include <analogBase.h>

Inheritance diagram for quadro::analog::analogBase:
quadro::IDevice quadro::IDevice quadro::analog::LVMaxSonarEZ

Public Types

enum  analogPort {
  PORT0 = 0, PORT1 = 1, PORT2 = 2, PORT3 = 3,
  PORT4 = 4, PORT5 = 5, PORT6 = 6
}
 

Public Member Functions

 ~analogBase ()
 
 analogBase ()
 
int getCurrentReading ()
 
void setDevicePort (analogPort _AP)
 
- Public Member Functions inherited from quadro::IDevice
virtual ~IDevice ()
 

Detailed Description

This class provides functionality for controlling analog devices on the beaglebone.

Member Enumeration Documentation

enum for the available ports that can be used for Analog communication

Enumerator
PORT0 

Analog Port 0 (P9, Pin 39)

PORT1 

Analog Port 1 (P9, Pin 40)

PORT2 

Analog Port 2 (P9, Pin 37)

PORT3 

Analog Port 3 (P9, Pin 38)

PORT4 

Analog Port 4 (P9, Pin 33)

PORT5 

Analog Port 5 (P9, Pin 36)

PORT6 

Analog Port 6 (P9, Pin 35)

58  {
59  PORT0 = 0,
60  PORT1 = 1,
61  PORT2 = 2,
62  PORT3 = 3,
63  PORT4 = 4,
64  PORT5 = 5,
65  PORT6 = 6
66  };
Analog Port 0 (P9, Pin 39)
Definition: analogBase.h:59
Analog Port 6 (P9, Pin 35)
Definition: analogBase.h:65
Analog Port 3 (P9, Pin 38)
Definition: analogBase.h:62
Analog Port 4 (P9, Pin 33)
Definition: analogBase.h:63
Analog Port 5 (P9, Pin 36)
Definition: analogBase.h:64
Analog Port 1 (P9, Pin 40)
Definition: analogBase.h:60
Analog Port 2 (P9, Pin 37)
Definition: analogBase.h:61

Constructor & Destructor Documentation

analogBase::~analogBase ( )

Public Destructor

37 { }
analogBase::analogBase ( )

Public Constructor - sets the default port to 0 and attempts to initialise that device.

Exceptions
analogSetupException
23 {
24 
25  this->setDevicePort( analogPort::PORT0 );
26  this->initDevice();
27  if ( this->_analogOverlay.settings.overlayLoaded ) {
28  this->setDeviceFilePath();
29  }
30  else {
31  snprintf( this->_analogOverlay.errMessage, sizeof( this->_analogOverlay.errMessage ),
32  "Fatal analogBase Error - Unable to initialise the analogBase Device." );
33  throw analogSetupException( this->_analogOverlay.errMessage );
34  }
35 }
bool overlayLoaded
Definition: analogOverlay.h:60
char errMessage[1024]
Definition: overlayBase.h:70
Definition: analogSetupException.h:40
struct quadro::analog::analogOverlay::overlaySettings settings
void setDevicePort(analogPort _AP)
Definition: analogBase.cpp:90

Member Function Documentation

int analogBase::getCurrentReading ( )

getCurrentReading is the public method that returns the result from the private readDevice()

Returns
50 {
51  this->readDevice( 1024 );
52  if ( this->currentReading.length() > 0 ) {
53  return stoi( this->currentReading );
54  }
55  else {
56  return 1;
57  }
58 }
void analogBase::setDevicePort ( analogPort  _AP)

setDevicePort allows selection of an analog port (analogPort)

Parameters
analogPort_AP
91 {
92  this->devicePort = DevicePort;
93 }

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