From 4a3d713bc73f7d627c16856afb32793e3a46e187 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 2 May 2013 12:27:21 -0700 Subject: [PATCH] remove the invensense testing program --- CMakeLists.txt | 3 +- invensense-test/CMakeLists.txt | 13 ----- invensense-test/src/main.cpp | 94 ---------------------------------- 3 files changed, 1 insertion(+), 109 deletions(-) delete mode 100644 invensense-test/CMakeLists.txt delete mode 100644 invensense-test/src/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b1001119d..3923f543fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,5 +9,4 @@ add_subdirectory(eve) add_subdirectory(interface) add_subdirectory(injector) add_subdirectory(space-server) -add_subdirectory(voxel-server) -add_subdirectory(invensense-test) \ No newline at end of file +add_subdirectory(voxel-server) \ No newline at end of file diff --git a/invensense-test/CMakeLists.txt b/invensense-test/CMakeLists.txt deleted file mode 100644 index b0dfed8990..0000000000 --- a/invensense-test/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set(ROOT_DIR ..) -set(MACRO_DIR ${ROOT_DIR}/cmake/macros) - -set(TARGET_NAME invensense-test) - -include(${MACRO_DIR}/SetupHifiProject.cmake) -setup_hifi_project(${TARGET_NAME}) - -# link the shared hifi library -include(${MACRO_DIR}/LinkHifiLibrary.cmake) -link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR}) \ No newline at end of file diff --git a/invensense-test/src/main.cpp b/invensense-test/src/main.cpp deleted file mode 100644 index dac4047ce3..0000000000 --- a/invensense-test/src/main.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// -// main.cpp -// invensense-test -// -// Created by Stephen Birarda on 4/30/13. -// Copyright (c) 2013 High Fidelity. All rights reserved. -// - -#include -#include -#include -#include -#include -#include - -void loadIntFromTwoHex(char* sourceBuffer, int& destinationInt) { - - unsigned int byte[2]; - - for(int i = 0; i < 2; i++) { - sscanf(sourceBuffer + 2 * i, "%2x", &byte[i]); -// printf("The hex code is 0x%c%c so the byte is %d\n", (sourceBuffer + 2 * i)[0], (sourceBuffer + 2 * i)[1], byte[i]); - } - - int16_t result = (byte[0] << 8); - result += byte[1]; - - destinationInt = result; -} - -int main(int argc, char* argv[]) { - int serialFd = open("/dev/tty.usbmodemfa141", O_RDWR | O_NOCTTY | O_NDELAY); - - struct termios options; - tcgetattr(serialFd, &options); - - cfsetispeed(&options,B115200); - cfsetospeed(&options,B115200); - - options.c_cflag |= (CLOCAL | CREAD); - options.c_cflag &= ~PARENB; - options.c_cflag &= ~CSTOPB; - options.c_cflag &= ~CSIZE; - options.c_cflag |= CS8; - tcsetattr(serialFd,TCSANOW,&options); - - // Flush the port's buffers (in and out) before we start using it - tcflush(serialFd, TCIOFLUSH); - - // block on read until data is available - int currentFlags = fcntl(serialFd, F_GETFL); - fcntl(serialFd, F_SETFL, currentFlags & ~O_NONBLOCK); - - write(serialFd, "WR686B01\n", 9); - usleep(100000); - write(serialFd, "SD\n", 3); - usleep(100000); - - tcflush(serialFd, TCIOFLUSH); - - char gyroBuffer[20] = {}; - int gyroX, gyroY, gyroZ; - int readBytes = 0; - - double lastRead = usecTimestampNow(); - - while (true) { - if (usecTimestampNow() - lastRead >= 10000) { - - write(serialFd, "RD684306\n", 9); - - readBytes = read(serialFd, gyroBuffer, 20); -// printf("Read %d bytes from serial\n", readBytes); - -// printf("The first two characters are %c%c\n", gyroBuffer[0], gyroBuffer[1]); - - if (readBytes == 20 && gyroBuffer[0] == 'R' && gyroBuffer[1] == 'D') { - loadIntFromTwoHex(gyroBuffer + 6, gyroX); - loadIntFromTwoHex(gyroBuffer + 10, gyroY); - loadIntFromTwoHex(gyroBuffer + 14, gyroZ); - - printf("The gyro data %d, %d, %d\n", gyroX, gyroY, gyroZ); - } - - lastRead = usecTimestampNow(); - } - } - - close(serialFd); - - return 0; -} - -