Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

adxl_util.h File Reference

Common routines for ADXL board - open,close, read, sighandler. 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>

Go to the source code of this file.

Data Structures

struct  adxl_reading_t
 Struct used to return raw and processed readings from the ADXL. More...


Defines

#define _ADXL_UTIL_H_
#define NUM_ADXL_CHANNELS   2
 Number of possible data channels - analog plus digital.

#define ADXL_READ_LEN   4
 Number of bytes per ADXL reading.

#define ADXL_DATUM_LEN   24
 Size of a NSDS-formatted reading - used for buffer sizing.

#define ADXL_MAX_RATE_HZ   250
 Max sample rate, approximate.


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 for ADXL board - open,close, read, sighandler.

Date:
5/3/03
Author:
Paul Hubbard

Definition in file adxl_util.h.


Define Documentation

#define _ADXL_UTIL_H_
 

Definition at line 34 of file adxl_util.h.

#define ADXL_DATUM_LEN   24
 

Size of a NSDS-formatted reading - used for buffer sizing.

Definition at line 59 of file adxl_util.h.

Referenced by daq_thread_main().

#define ADXL_MAX_RATE_HZ   250
 

Max sample rate, approximate.

Definition at line 62 of file adxl_util.h.

Referenced by main().

#define ADXL_READ_LEN   4
 

Number of bytes per ADXL reading.

Definition at line 56 of file adxl_util.h.

Referenced by adxl_read().

#define NUM_ADXL_CHANNELS   2
 

Number of possible data channels - analog plus digital.

Definition at line 53 of file adxl_util.h.

Referenced by adxl_do_work(), daq_do_work(), daq_thread_main(), data_channel_enabled(), data_channel_flag(), and main().


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 49 of file adxl_util.h.

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