main_regdump.c
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // main_regdump.c - Epson IMU sensor test application
4 // - This program reads all registers values for debug purpose
5 //
6 //
7 // THE SOFTWARE IS RELEASED INTO THE PUBLIC DOMAIN.
8 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
9 // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT,
10 // SECURITY, SATISFACTORY QUALITY, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
11 // SHALL EPSON BE LIABLE FOR ANY LOSS, DAMAGE OR CLAIM, ARISING FROM OR IN CONNECTION
12 // WITH THE SOFTWARE OR THE USE OF THE SOFTWARE.
13 //
14 //==============================================================================
15 #include <stdint.h>
16 #include <stdio.h>
17 #include <time.h>
18 
19 #include "hcl.h"
20 #include "hcl_gpio.h"
21 #include "sensor_epsonCommon.h"
22 
23 #include <termios.h> // Low-level functions for UART communication
24 #include "hcl_uart.h"
25 int comPort;
26 // Modify below as needed for hardware
27 const char *IMUSERIAL = "/dev/ttyUSB0";
28 const int IMUBAUD = B460800;
29 
30 
31 int main(int argc, char *argv[])
32 {
33  int i;
34 
35  // 1) Initialize the Seiko Epson HCL layer
36  printf("\r\nInitializing HCL layer...");
37  if (!seInit()){
38  printf("\r\nError: could not initialize the Seiko Epson HCL layer. Exiting...\r\n");
39  return -1;
40  }
41  printf("...done.\r\n");
42 
43  // 2) Initialize the GPIO interfaces, including the SPI CS
44  printf("\r\nInitializing GPIO interface...");
45  if (!gpioInit()){
46  printf("\r\nError: could not initialize the GPIO layer. Exiting...\r\n");
47  return -1;
48  }
49  printf("...done.");
50 
51  // 3) Initialize UART Interface
52  printf("\r\nInitializing UART interface...");
54  if(comPort == -1)
55  {
56  printf("\r\nError: could not initialize UART interface. Exiting...\r\n");
57  return -1;
58  }
59  printf("...done.");
60 
61  sensorStop();
62  registerDump();
64  gpioRelease();
65  seRelease();
66  printf("\r\n");
67 
68  printf("\r\nThe following arguments were passed to main(): ");
69  for(i=1; i<argc; i++) printf("%s ", argv[i]);
70  printf("\r\n");
71  return 0;
72 }
int comPort
Definition: main_regdump.c:25
const int IMUBAUD
Definition: main_regdump.c:28
int seInit(void)
Definition: hcl_linux.c:28
const char * IMUSERIAL
Definition: main_regdump.c:27
int gpioInit(void)
Definition: hcl_gpio.c:29
int uartInit(const char *comPortPath, int baudRate)
Definition: hcl_uart.c:222
void registerDump(void)
void sensorStop(void)
int gpioRelease(void)
Definition: hcl_gpio.c:41
int main(int argc, char *argv[])
Definition: main_regdump.c:31
int uartRelease(ComPortHandle comPort)
Definition: hcl_uart.c:236
int seRelease(void)
Definition: hcl_linux.c:42


epson_g364_imu_driver
Author(s):
autogenerated on Mon Jun 10 2019 13:12:32