Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

adxl_util.c File Reference

Common routines - open/read/close, signal handler, etc. More...

#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <sys/termios.h>
#include <fcntl.h>
#include "nsds_util.h"
#include "flog.h"
#include "adxl_util.h"

Go to the source code of this file.

Functions

int adxl_open (const char *COMPORT_FILE)
 Open port and configure control lines, etc.

int adxl_read (const int COMM_FD, adxl_reading_t *result)
 Read a single set of values from the ADXL board.

int adxl_close (const int COMM_FD)
 Simple wrapper to close the port.

void adxl_sighandler (int signal)
 Control-break handler. Sets global flag to indicate exit request.


Variables

bool control_break
 Global boolean set by signal handler to force exit.


Detailed Description

Common routines - open/read/close, signal handler, etc.

Date:
5/3/03
Author:
Paul Hubbard

Definition in file adxl_util.c.


Function Documentation

int adxl_close const int  COMM_FD  ) 
 

Simple wrapper to close the port.

... which releases the control lines and shuts down the DAQ.

Parameters:
COMM_FD File descriptor of the opened serial port to be closed
Return values:
0 Completed OK
Non-zero An error occurred
Date:
3/11/02
Note:
minor changes from original

Definition at line 182 of file adxl_util.c.

Referenced by adxl_do_work(), and daq_thread_main().

int adxl_open const char *  COMPORT_FILE  ) 
 

Open port and configure control lines, etc.

Function to open the serial port and set up the rather peculiar comms requirements of the ADXL202: 38400 baud, N81 No flow control (?) Powered by RTS

Parameters:
COMPORT_FILE Pointer to filename to open, not modified. If NULL, uses environment variable ADXL_PORT. If that's not defined, we try /dev/ttyS1
Returns:
0 Operation successful

Non-zero An error occurred

Definition at line 47 of file adxl_util.c.

Referenced by adxl_do_work(), and daq_thread_main().

int adxl_read const int  COMM_FD,
adxl_reading_t result
 

Read a single set of values from the ADXL board.

Parameters:
COMM_FD File descriptor of open serial port
result Pointer, used to store output
Returns:
0 OK

Non-zero Error occurred

Note:
Returns values from 0 to 100, with 50 being neutral.

Definition at line 118 of file adxl_util.c.

References ADXL_READ_LEN, adxl_reading_t::G, and adxl_reading_t::raw.

Referenced by adxl_do_work(), and daq_thread_main().

void adxl_sighandler int  signal  ) 
 

Control-break handler. Sets global flag to indicate exit request.

Note:
Assumes installed in interrupt chain by someone else
Parameters:
signal Signal number
Note:
Common with nees-di code, roll into library?
Date:
3/25/02

Definition at line 202 of file adxl_util.c.

References control_break.

Referenced by main().


Variable Documentation

bool control_break
 

Global boolean set by signal handler to force exit.

Definition at line 26 of file adxl_util.c.

Referenced by adxl_do_work(), adxl_sighandler(), daq_main_loop(), daq_thread_main(), and main().


Generated on Fri May 2 15:13:15 2003 for ADXL202-NEESgrid driver by doxygen1.3