Main Page
+
Classes
Class List
+
Class Members
+
All
a
c
d
e
f
g
h
i
m
n
o
p
q
r
t
y
Functions
+
Variables
a
c
d
e
f
g
h
i
m
n
o
p
q
r
t
y
+
Files
File List
+
File Members
+
All
a
b
c
d
e
f
g
i
m
n
o
p
r
s
t
u
v
w
+
Functions
c
g
i
m
n
o
p
r
s
u
w
Variables
Typedefs
+
Macros
a
b
c
d
e
f
n
o
r
s
t
v
src
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
9
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10
// NONINFRINGEMENT, SECURITY, SATISFACTORY QUALITY, AND FITNESS FOR A
11
// PARTICULAR PURPOSE. IN NO EVENT SHALL EPSON BE LIABLE FOR ANY LOSS, DAMAGE
12
// OR CLAIM, ARISING FROM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THE
13
// SOFTWARE.
14
//
15
//==============================================================================
16
#include <stdint.h>
17
#include <stdio.h>
18
#include <string.h>
19
#include <termios.h>
20
#include <
time.h
>
21
22
#include "
hcl.h
"
23
#include "
hcl_gpio.h
"
24
#include "
hcl_uart.h
"
25
#include "
main_helper.h
"
26
#include "
sensor_epsonCommon.h
"
27
28
int
fd_serial
;
29
30
// Modify below as needed for hardware
31
const
char
*
IMUSERIAL
=
"/dev/ttyUSB0"
;
32
33
int
main
(
int
argc,
char
* argv[]) {
34
char
prod_id[9];
// Device Product ID
35
char
ser_id[9];
// Device Serial ID
36
37
// 1) Initialize the Seiko Epson HCL layer
38
printf(
"\r\nInitializing HCL layer..."
);
39
if
(!
seInit
()) {
40
printf(
41
"\r\nError: could not initialize the Seiko Epson HCL layer. "
42
"Exiting...\r\n"
);
43
return
-1;
44
}
45
printf(
"...done.\r\n"
);
46
47
// 2) Initialize the GPIO interfaces, For GPIO control of pins SPI CS, RESET,
48
// DRDY
49
printf(
"\r\nInitializing GPIO interface..."
);
50
if
(!
gpioInit
()) {
51
printf(
"\r\nError: could not initialize the GPIO layer. Exiting...\r\n"
);
52
seRelease
();
53
return
-1;
54
}
55
printf(
"...done.\r\n"
);
56
57
// 3) Initialize UART Interface
58
// The baudrate value should be set the the same setting as currently
59
// flashed value in the IMU UART_CTRL BAUD_RATE register
60
printf(
"\r\nInitializing UART interface..."
);
61
fd_serial
=
uartInit
(
IMUSERIAL
,
BAUD_460800
);
62
if
(
fd_serial
== -1) {
63
printf(
"\r\nError: could not initialize UART interface. Exiting...\r\n"
);
64
gpioRelease
();
65
seRelease
();
66
return
-1;
67
}
68
printf(
"...done.\r\n"
);
69
70
// 4) Print out which model executable was compiled and identify model
71
printf(
"\r\nCompiled for:\t"
BUILD_FOR);
72
printf(
"\r\nReading device info..."
);
73
if
(strcmp(BUILD_FOR,
getProductId
(prod_id)) != 0) {
74
printf(
"\r\n*** Build *mismatch* with detected device ***"
);
75
printf(
76
"\r\n*** Ensure you specify a compatible 'MODEL=' variable when "
77
"running make when rebuilding the driver ***\r\n"
);
78
}
79
printf(
"\r\nPRODUCT ID:\t%s"
,
getProductId
(prod_id));
80
printf(
"\r\nSERIAL ID:\t%s"
,
getSerialId
(ser_id));
81
82
// Incase, the IMU is currently in sampling mode, force config mode before
83
// attempting to read from registers
84
sensorStop
();
85
registerDump
();
86
uartRelease
(
fd_serial
);
87
gpioRelease
();
88
seRelease
();
89
printf(
"\r\n"
);
90
91
return
0;
92
}
BAUD_460800
#define BAUD_460800
Definition:
hcl_uart.h:24
time.h
uartInit
int uartInit(const char *comPortPath, int baudrate)
Definition:
hcl_uart.c:52
uartRelease
int uartRelease(ComPortHandle fd_serial)
Definition:
hcl_uart.c:83
seInit
int seInit(void)
Definition:
hcl_linux.c:30
getSerialId
char * getSerialId(char *pcharArr)
Definition:
sensor_epsonCommon.c:391
IMUSERIAL
const char * IMUSERIAL
Definition:
main_regdump.c:31
gpioInit
int gpioInit(void)
Definition:
hcl_gpio.c:33
hcl.h
registerDump
void registerDump(void)
Definition:
sensor_epsonG320.c:137
sensorStop
void sensorStop(void)
Definition:
sensor_epsonCommon.c:113
gpioRelease
int gpioRelease(void)
Definition:
hcl_gpio.c:41
main
int main(int argc, char *argv[])
Definition:
main_regdump.c:33
getProductId
char * getProductId(char *pcharArr)
Definition:
sensor_epsonCommon.c:365
seRelease
int seRelease(void)
Definition:
hcl_linux.c:38
main_helper.h
hcl_uart.h
hcl_gpio.h
sensor_epsonCommon.h
fd_serial
int fd_serial
Definition:
main_regdump.c:28
ess_imu_ros1_uart_driver
Author(s):
autogenerated on Sun Jun 4 2023 02:59:29