#include <stdio.h>
#include <error.h>
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <string.h>
#include <pwd.h>
#include <sys/time.h>
#include "cyberglove/serial_glove.h"
Go to the source code of this file.
Functions | |
float * | glove_get_values () |
sample the glove values - need to call setup_glove first | |
void | open_board (char *port) |
int | read_button_value () |
int | read_stepping (int fd, unsigned char *b, int n) |
void | read_values (float *dest) |
int | setup_glove (const char *path_to_glove) |
void | writeg (int fd, char *b, int n) |
Variables | |
char | glove_message [100] |
float | glove_positions [GLOVE_SIZE] |
int | glove_reads = 0 |
int | glove_start_reads = 0 |
int | gloveButtonValue = 0 |
FILE * | serial |
static int | serial_port_fd = -1 |
struct termios | termios_save |
static float | values [GLOVE_SIZE] |
int | VERBOSE = 0 |
sudo cc -c -I/usr/realtime/include/ serial_glove.c -o serial_glove.o |
This program talks to a cyberglove on the serial port
The only purpose is to continually sample the glove and to store the values in the array glove_positions
The program provides the function
Definition in file serial_glove.c.
float* glove_get_values | ( | void | ) |
sample the glove values - need to call setup_glove first
Definition at line 226 of file serial_glove.c.
void open_board | ( | char * | port | ) |
get attributes associated with the serial port
trying the following lines to restart serial port, see read_stepping() function
Definition at line 60 of file serial_glove.c.
int read_button_value | ( | void | ) |
Definition at line 187 of file serial_glove.c.
int read_stepping | ( | int | fd, | |
unsigned char * | b, | |||
int | n | |||
) |
called by read_values b is length GLOVE_SIZE + 2 because the first two characters returned are G and ' '
Definition at line 106 of file serial_glove.c.
void read_values | ( | float * | dest | ) |
if any of the values are zero restart read as not considered reliable
Definition at line 145 of file serial_glove.c.
int setup_glove | ( | const char * | path_to_glove | ) |
Definition at line 205 of file serial_glove.c.
void writeg | ( | int | fd, | |
char * | b, | |||
int | n | |||
) |
Definition at line 136 of file serial_glove.c.
char glove_message[100] |
Definition at line 54 of file serial_glove.c.
float glove_positions[GLOVE_SIZE] |
Definition at line 48 of file serial_glove.c.
int glove_reads = 0 |
Definition at line 52 of file serial_glove.c.
int glove_start_reads = 0 |
Definition at line 52 of file serial_glove.c.
int gloveButtonValue = 0 |
Definition at line 50 of file serial_glove.c.
FILE* serial |
Definition at line 43 of file serial_glove.c.
int serial_port_fd = -1 [static] |
Definition at line 58 of file serial_glove.c.
struct termios termios_save |
Definition at line 57 of file serial_glove.c.
float values[GLOVE_SIZE] [static] |
Definition at line 45 of file serial_glove.c.
int VERBOSE = 0 |
sudo cc -c -I/usr/realtime/include/ serial_glove.c -o serial_glove.o
Definition at line 41 of file serial_glove.c.