/usr/include/Aria/ArVersalogicIO.h is in libaria-dev 2.8.0+repack-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you wish to redistribute ARIA under different terms, contact
Adept MobileRobots for information about a commercial version of ARIA at
robots@mobilerobots.com or
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
#ifndef ARVERSALOGICIO_H
#define ARVERSALOGICIO_H
//#ifndef SWIG
#include "ariaTypedefs.h"
#include "ArRobot.h"
/** @brief Interface to integrated digital and analog I/O interfaces on Versalogic VSBC8 and EBX-12 Cobra computers (digital IO on 2nd * gen. PatrolBot)
This class is a basic set of calls to use the Linux device driver, <code>amrio</code>,
which reads and writes data to VersaLogic's Opto22 and analog interfaces.
The <code>amrio</code> driver must be built into the Linux kernel or its
module loaded. Contact MobileRobots for information about obtaining this
driver.
It currently supports the Versalogic VSBC-8d, VSBC-8k, and EBX12 (Cobra) motherboards.
The digital portion of the Opto22 consists of two banks of 8 pins on the VSBC8
and four banks of 8 pins on the EBX12. Each bank can be set as either inputs
or outputs. The banks are zero-indexed, so bank0 is the first one.
The analog inputs require a separate chip. There are 8 inputs, only
one of which can be read at a time. It currently returns a value between
0 and 4096 or a decimal value in the range of 0-5V. The constructor will attempt
an analog conversion, and if it fails will assume that the chip is not present
and will disable the analog function.
See the motherboard manual for information about physical connections and specifications of the analog input and Opto22 digital IO.
Computer motherboard manuals are available at http://robots.mobilerobots.com/docs .
The SPECIAL_CONTROL_REGISTER contains a few bits of information, the one of
importance at the moment is the CPU_OVERTEMPERATURE bit, which will be set
high if the CPU temp is over the warning temp as set in the BIOS. Bitwise
AND the special_control_register output with 0x20 to find the temperature
bit.
The destructor closes the device, so just delete the ArVersalogicIO instance
to close the device.
@ingroup OptionalClasses
@ingroup DeviceClasses
@notwindows
*/
class ArVersalogicIO
{
public:
enum Direction
{
DIGITAL_INPUT,
DIGITAL_OUTPUT
};
/// Constructor
AREXPORT ArVersalogicIO(const char * dev = "/dev/amrio");
/// Destructor
AREXPORT virtual ~ArVersalogicIO(void);
/// tries to close the device. Returns false if operation failed
AREXPORT bool closeIO(void);
/// returns true if the device is opened and operational
AREXPORT bool isEnabled(void) { return myEnabled; }
/// returns true if analog values are supported
AREXPORT bool isAnalogSupported(void) { return myAnalogEnabled; }
/// Take an analog reading from a port number from 0-7.
/// This returns a conversion of the bits to a decimal value,
/// currently assumed to be in the 0-5V range
AREXPORT bool getAnalogValue(int port, double *val);
/// Take an analog reading from a port number from 0-7.
/// This returns the actual reading from the chip, which is 12-bits
AREXPORT bool getAnalogValueRaw(int port, int *val);
/// returns the direction (input or output) for the given bank
AREXPORT Direction getDigitalBankDirection(int bank);
/// set direction for a particular digital I/O bank
AREXPORT bool setDigitalBankDirection(int bank, Direction dir);
/// get the current value of the digital inputs on a certain bank
AREXPORT bool getDigitalBankInputs(int bank, unsigned char *val);
/// get the current value of the digital outputs bits on a certain bank
AREXPORT bool getDigitalBankOutputs(int bank, unsigned char *val);
/// set the value of the digital outputs bits
AREXPORT bool setDigitalBankOutputs(int bank, unsigned char val);
/// gets the special register of the motherboard.
AREXPORT bool getSpecialControlRegister(unsigned char *val);
/// lock the amrio device instance
AREXPORT int lock(void){ return(myMutex.lock()); }
/// unlock the amrio device instance
AREXPORT int unlock(void){ return(myMutex.unlock()); }
/// Try to lock the device instance without blocking
AREXPORT int tryLock() {return(myMutex.tryLock());}
protected:
static ArMutex myMutex;
int myFD;
bool myEnabled;
bool myAnalogEnabled;
int myNumBanks;
unsigned char myDigitalBank0;
unsigned char myDigitalBank1;
unsigned char myDigitalBank2;
unsigned char myDigitalBank3;
ArRetFunctorC<bool, ArVersalogicIO> myDisconnectCB;
};
//#endif // SWIG
#endif // ARVERSALOGICIO_H
|