Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

di194.h

Go to the documentation of this file.
00001 
00019 #ifndef _DI194_H_
00020 #define _DI194_H_
00021 
00022 #include <ctype.h>
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include <stddef.h>
00026 #include <string.h>
00027 #include <unistd.h>
00028 #include <sys/errno.h>
00029 #include <sys/times.h>
00030 #include <sys/termios.h>
00031 #include <fcntl.h>
00032 #include <stdint.h>
00033 #include <time.h>
00034 #include <signal.h>
00035 #include <sys/ioctl.h>
00036 #include <fcntl.h>
00037 
00038 #include <stdbool.h>
00039 
00040 // ---------------------------------------------------------------------
00041 // Local defines, structs, etc.
00042 
00044 typedef enum 
00045 {
00046     DI_RATE_INVALID,
00047     DI_RATE_60HZ,
00048     DI_RATE_120HZ,
00049     DI_RATE_240HZ,
00050     DI_RATE_UNKNOWN 
00051 } di_rate_t;
00052 
00057 typedef struct 
00058 {
00059     float       analog[4];
00060     uint16_t    raw[4];
00061     bool        digital[3];
00062     bool        is_valid;
00063 } daq_reading_t;
00064 
00066 typedef uint8_t   daq_buf_t[8];
00067 
00069 #if !defined(SERIAL_NUM_LEN)
00070 #define SERIAL_NUM_LEN 10
00071 #endif
00072 
00073 // Function prototypes
00074 int di_serial_init(const char *COMPORT_FILE);
00075 int min(const int A, const int B);
00076 void hex_print_byte(const uint8_t in_byte);
00077 int di_serial_read(const int COMM_FD, const uint8_t *buf,
00078                    const int READ_LEN, const time_t TIMEOUT);
00079 void di_cmd_print(const uint8_t *cmd, const int CMD_LEN);
00080 bool is_reset_cmd(const uint8_t *cmd, const int CMD_LEN);
00081 int di_daq_sync(const int COMM_FD);
00082 int di_cmd_send(const int COMM_FD, const uint8_t *cmd, const int CMD_LEN);
00083 int di_initialize(const int COMM_FD, int *num_bits);
00084 int di_configure(const int COMM_FD);
00085 int di_buf_decode(const daq_buf_t buf, daq_reading_t *result, 
00086                   const int NUM_BITS);
00087 int di_buf_validate(const daq_buf_t buf);
00088 char *di_byte_print(const uint8_t in_byte);
00089 
00090 // User-called functions
00091 int di_open(const char *COMPORT_FILE, int *num_bits);
00092 int di_close(const int COMM_FD);
00093 int di_read(const int COMM_FD, daq_reading_t *data, const int NUM_BITS);
00094 int di_start(const int COMM_FD);
00095 int di_stop(const int COMM_FD);
00096 int di_reset(const int COMM_FD);
00097 int di_serial_num(const int COMM_FD, char *ser_buf);
00098 int di_read_single(const int COMM_FD, daq_reading_t *data, const int NUM_BITS);
00099 
00100 #endif /* _DI194_H_ */
00101 

Generated on Tue Feb 3 16:47:26 2004 for DI-194 driver by doxygen1.2.18