Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

common.h File Reference


Detailed Description

Communicate with serial device.

Author:
Author
jayhawk_hokie
Version:
Revision
1.4
Date:
Date
2007/08/02 23:18:28

Definition in file common.h.

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define CRC_16   0xa001
#define CRC_CCITT   0x8408

Typedefs

typedef __uint8_t uint8
typedef __uint16_t uint16

Functions

uint16 mbcrc_calc (uint8 *data, int len)
uint16 mbcwc_tlu (uint8 *data, int len)
int init_serial (char *portfn, speed_t brate, int *portfd)
 Initialize serial port
The presumption was that we'd always be talking exclusively to devices in 8N1. Now, to use 2 stop bits, we had to use a define to avoid rewriting all the code that uses init_serial as it is already written. Any major version change should incorporate an option for doing this properly in the code.
int say (int fd, char *str)
 Send data string to serial port.
int hear (int fd, char *str, int maxlen, int minlen, int maxbtime, char term)
 hear function reads data from serial port


Define Documentation

#define CRC_16   0xa001
 

Definition at line 14 of file common.h.

#define CRC_CCITT   0x8408
 

Definition at line 15 of file common.h.


Typedef Documentation

typedef __uint16_t uint16
 

Definition at line 17 of file common.h.

typedef __uint8_t uint8
 

Definition at line 16 of file common.h.


Function Documentation

int hear int  fd,
char *  str,
int  maxlen,
int  minlen,
int  maxbtime,
char  term
 

hear function reads data from serial port

Parameters:
fd file descriptor for port
*str pointer to return string
maxlen maximum length of return string
minlen minimum length of return string ( 0 = end string at character return, !0 = minimum length)
maxbtime maximum blocking time for select function (select function looks for ports to read)
term termination character to search for if minlen = 0
Returns:
int 0 if successful

Definition at line 115 of file common.c.

Referenced by Magnetometer::AsciiParser(), Magnetometer::BinaryParser(), PhysicalMomentumWheel::ChangeBaud(), Magnetometer::ContinuousDataConfiguration(), Magnetometer::DefaultConfiguration(), PhysicalControlMomentGyro::FindLimits(), PhysicalMomentumWheel::GetAmps(), PhysicalTiltSensor::GetAngles(), PhysicalMomentumWheel::GetVolts(), PhysicalTiltSensor::Initialize(), PhysicalLinearActuator::Initialize(), main(), Magnetometer::PolledDataConfiguration(), Magnetometer::QuerryConfiguration(), PhysicalControlMomentGyro::QueryAngle(), PhysicalLinearActuator::QueryCurrentPosition(), QueryWheelSpeed(), PhysicalControlMomentGyro::QueryWheelSpeed(), PhysicalMomentumWheel::QueryWheelTorque(), PhysicalControlMomentGyro::QueryWheelTorque(), Magnetometer::ReEnterOffConfiguration(), Magnetometer::ReEnterOnConfiguration(), Magnetometer::SetAsciiConfiguration(), Magnetometer::SetAveragingOffConfiguration(), Magnetometer::SetAveragingOnConfiguration(), Magnetometer::SetBaud19200Configuration(), Magnetometer::SetBinaryConfiguration(), Magnetometer::SetResetOffConfiguration(), Magnetometer::SetResetOnConfiguration(), Magnetometer::SetSampleRateConfiguration(), PhysicalLinearActuator::StartJog(), and Magnetometer::~Magnetometer().

int init_serial char *  portfn,
speed_t  brate,
int *  portfd
 

Initialize serial port
The presumption was that we'd always be talking exclusively to devices in 8N1. Now, to use 2 stop bits, we had to use a define to avoid rewriting all the code that uses init_serial as it is already written. Any major version change should incorporate an option for doing this properly in the code.

Parameters:
*portfn pointer to port file name
brate 
*portfd pointer to port file descripter
Returns:
int 0 if successful

Definition at line 27 of file common.c.

Referenced by _daq(), PhysicalTiltSensor::Initialize(), PhysicalMomentumWheel::Initialize(), PhysicalLinearActuator::Initialize(), PhysicalControlMomentGyro::Initialize(), Magnetometer::Initialize(), and main().

uint16 mbcrc_calc uint8 data,
int  len
 

uint16 mbcwc_tlu uint8 data,
int  len
 

int say int  fd,
char *  str
 

Send data string to serial port.

Parameters:
fd file descriptor for port
*str pointer to return string
Returns:
int 0 if successful

Definition at line 74 of file common.c.

Referenced by Magnetometer::AsciiParser(), Magnetometer::BinaryParser(), PhysicalMomentumWheel::ChangeBaud(), PhysicalControlMomentGyro::CommandAngle(), PhysicalControlMomentGyro::CommandGimbalRate(), PhysicalMomentumWheel::CommandSystemTorque(), PhysicalControlMomentGyro::CommandWheelSpeed(), PhysicalControlMomentGyro::CommandWheelTorque(), Magnetometer::ContinuousDataConfiguration(), Magnetometer::DefaultConfiguration(), PhysicalMomentumWheel::EchoOff(), PhysicalMomentumWheel::EchoOn(), PhysicalMomentumWheel::EnableTorqueMode(), PhysicalControlMomentGyro::FindLimits(), PhysicalMomentumWheel::GetAmps(), PhysicalTiltSensor::GetAngles(), PhysicalMomentumWheel::GetVolts(), PhysicalControlMomentGyro::GoCommand(), PhysicalTiltSensor::Initialize(), PhysicalLinearActuator::Initialize(), PhysicalControlMomentGyro::Initialize(), main(), Magnetometer::PolledDataConfiguration(), Magnetometer::QuerryConfiguration(), PhysicalControlMomentGyro::QueryAngle(), PhysicalLinearActuator::QueryCurrentPosition(), QueryWheelSpeed(), PhysicalControlMomentGyro::QueryWheelSpeed(), PhysicalMomentumWheel::QueryWheelTorque(), PhysicalControlMomentGyro::QueryWheelTorque(), Magnetometer::ReEnterOffConfiguration(), Magnetometer::ReEnterOnConfiguration(), PhysicalMomentumWheel::Reset(), Magnetometer::SetAsciiConfiguration(), Magnetometer::SetAveragingOffConfiguration(), Magnetometer::SetAveragingOnConfiguration(), Magnetometer::SetBaud19200Configuration(), Magnetometer::SetBinaryConfiguration(), Magnetometer::SetResetOffConfiguration(), Magnetometer::SetResetOnConfiguration(), Magnetometer::SetSampleRateConfiguration(), PhysicalLinearActuator::SetVelocity(), PhysicalLinearActuator::StartJog(), PhysicalLinearActuator::Stop(), PhysicalMomentumWheel::TorqueCommand(), PhysicalLinearActuator::TravelDistance(), PhysicalLinearActuator::TravelPosition(), and Magnetometer::~Magnetometer().


Generated on Wed Sep 5 12:54:29 2007 for DSACSS Operational Code by  doxygen 1.3.9.1