sensor_epsonCommon.h
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // sensor_epsonCommon.h - Epson IMU sensor specific definitions common
4 // for all IMU models
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 #ifndef EPSONCOMMON_H_
17 #define EPSONCOMMON_H_
18 
19 #include <math.h>
20 #include <stdio.h>
21 
22 #ifndef TRUE
23 #define TRUE (1)
24 #endif
25 
26 #ifndef FALSE
27 #define FALSE (0)
28 #endif
29 
30 #if G320PDG0
31 #include "sensor_epsonG320.h"
32 #elif G330PDG0
33 #include "sensor_epsonG330PDG0.h"
34 #elif G354PDH0
35 #include "sensor_epsonG354.h"
36 #elif G364PDC0
37 #include "sensor_epsonG364PDC0.h"
38 #elif G364PDCA
39 #include "sensor_epsonG364PDCA.h"
40 #elif G365PDC1
41 #include "sensor_epsonG365PDC1.h"
42 #elif G365PDF1
43 #include "sensor_epsonG365PDF1.h"
44 #elif G366PDG0
45 #include "sensor_epsonG366PDG0.h"
46 #elif G370PDF1
47 #include "sensor_epsonG370PDF1.h"
48 #elif G370PDS0
49 #include "sensor_epsonG370PDS0.h"
50 #elif G370PDG0
51 #include "sensor_epsonG370PDG0.h"
52 #elif G370PDT0
53 #include "sensor_epsonG370PDT0.h"
54 #elif V340PDD0
55 #include "sensor_epsonV340.h"
56 #else // G366PDG0
57 #include "sensor_epsonG366PDG0.h"
58 #endif
59 
60 #define DELAY_EPSON_RESET 10 // Milliseconds Reset Pulse Width
61 #define EPSON_POWER_ON_DELAY 800 // Milliseconds
62 #define EPSON_FLASH_TEST_DELAY 5 // Milliseconds
63 #define EPSON_SELF_TEST_DELAY 80 // Milliseconds
64 #define EPSON_FILTER_DELAY 1 // Milliseconds
65 #define EPSON_ATTI_PROFILE_DELAY 1 // Milliseconds
66 
67 // Required delay between bus cycles for serial timings
68 #define EpsonStall() seDelayMicroSecs(EPSON_STALL)
69 
70 struct EpsonOptions {
71  // MSC_CTRL
72  int ext_sel;
73  int ext_pol;
74  int drdy_on;
75  int drdy_pol;
76 
77  // SMPL_CTRL
78  int dout_rate;
79 
80  // FILTER_CTRL
82 
83  // BURST_CTRL1
84  int flag_out;
85  int temp_out;
86  int gyro_out;
87  int accel_out;
90  int qtn_out;
91  int atti_out;
92 
93  int gpio_out;
94  int count_out;
96 
97  // BURST_CTRL2
98  int temp_bit;
99  int gyro_bit;
103  int qtn_bit;
104  int atti_bit;
105 
106  // POL_CTRL
113 
114  // DLT_CTRL
117 
118  // ATTI_CTRL
121 
122  // ATTI_MOTION_PROFILE
124 };
125 
126 struct EpsonData {
127  unsigned short ndflags;
128  float temperature;
129  float gyro_x, gyro_y, gyro_z;
130  float accel_x, accel_y, accel_z;
131  float gyro_delta_x, gyro_delta_y, gyro_delta_z;
132  float accel_delta_x, accel_delta_y, accel_delta_z;
133  float qtn0, qtn1, qtn2, qtn3;
134  float roll, pitch, yaw;
135  unsigned short gpio;
136  int count;
137 };
138 
140 int sensorHWReset(void);
141 int sensorPowerOn(void);
142 void registerDump(void);
143 void registerWriteByte(unsigned char, unsigned char, unsigned char,
144  unsigned int);
145 unsigned short registerRead16(unsigned char, unsigned char, unsigned int);
146 void registerWriteByteNoId(unsigned char, unsigned char, unsigned int);
147 unsigned short registerRead16NoId(unsigned char, unsigned int);
148 void sensorStart(void);
149 void sensorStop(void);
150 void sensorReset(void);
151 int sensorFlashTest(void);
152 int sensorSelfTest(void);
153 int sensorInitialBackup(void);
154 int sensorInitOptions(struct EpsonOptions);
155 unsigned int sensorDataByteLength(struct EpsonOptions);
156 void sensorDummyWrite(void);
158 void populateEpsonData(struct EpsonOptions, struct EpsonData*);
159 char* getProductId(char* strDest);
160 char* getSerialId(char* strDest);
161 
162 #endif /* EPSONCOMMON_H_ */
unsigned short gpio
void sensorStart(void)
int sensorDataReadBurstNOptions(struct EpsonOptions, struct EpsonData *)
unsigned short ndflags
int sensorSelfTest(void)
void sensorStop(void)
int sensorInitOptions(struct EpsonOptions)
int sensorInitialBackup(void)
void populateEpsonData(struct EpsonOptions, struct EpsonData *)
int sensorFlashTest(void)
void registerDump(void)
int sensorPowerOn(void)
char * getProductId(char *strDest)
int sensorDataReadyOptions(struct EpsonOptions)
unsigned int sensorDataByteLength(struct EpsonOptions)
unsigned short registerRead16(unsigned char, unsigned char, unsigned int)
void registerWriteByte(unsigned char, unsigned char, unsigned char, unsigned int)
char * getSerialId(char *strDest)
void registerWriteByteNoId(unsigned char, unsigned char, unsigned int)
void sensorReset(void)
void sensorDummyWrite(void)
unsigned short registerRead16NoId(unsigned char, unsigned int)
int sensorHWReset(void)


ess_imu_ros1_uart_driver
Author(s):
autogenerated on Sun Jun 4 2023 02:59:29