sensor_epsonUart.c
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // sensor_epsonUart.c - Epson IMU sensor protocol UART specific code
4 //
5 //
6 // THE SOFTWARE IS RELEASED INTO THE PUBLIC DOMAIN.
7 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9 // NONINFRINGEMENT, SECURITY, SATISFACTORY QUALITY, AND FITNESS FOR A
10 // PARTICULAR PURPOSE. IN NO EVENT SHALL EPSON BE LIABLE FOR ANY LOSS, DAMAGE
11 // OR CLAIM, ARISING FROM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THE
12 // SOFTWARE.
13 //
14 //==============================================================================
15 
16 #include <stdio.h>
17 
18 #include "hcl.h"
19 #include "hcl_uart.h"
20 #include "sensor_epsonCommon.h"
21 #include "sensor_epsonUart.h"
22 
23 // This is declared by the main() application for UART IF
24 extern const char* IMUSERIAL; // COM port device name
25 
26 // UART Byte Markers
27 // Start of all UART transfers
28 const unsigned char UART_HEADER = 0x80;
29 // End of all UART transfers
30 const unsigned char UART_DELIMITER = 0x0D;
31 
32 // COM port receive buffer
33 static unsigned char rxByteBuf[256];
34 
35 // Macros & variables used by state machine for processing UART burst read data
36 #define START 0
37 #define DATA 1
38 #define END 2
39 static int state = START;
40 static int data_count = 0;
41 
42 // Local function prototypes
43 int sensorDataReadyOptions(const struct EpsonProperties*,
44  const struct EpsonOptions*);
45 void sensorDataScaling(const struct EpsonProperties*,
46  const struct EpsonOptions*, struct EpsonData*);
47 
48 /*****************************************************************************
49 ** Function name: writeByte
50 ** Description: Write Byte to Register = Write Data
51 ** to Register (no WIN_ID)
52 ** Parameters: Register Address, Register Write Byte,
53 ** Verbose Flag
54 ** Return value: None
55 *****************************************************************************/
56 void writeByte(unsigned char regAddr, unsigned char regByte,
57  unsigned int verbose) {
58  unsigned char txData[3];
59 
60  // msb is 1b for register writes
61  txData[0] = regAddr | 0x80;
62  txData[1] = regByte;
63  txData[2] = UART_DELIMITER;
64  writeComPort(txData, 3);
65  epsonStall();
66 
67  if (verbose) {
68  printf("\r\nREG[0x%02X] < 0x%02X\t", regAddr, regByte);
69  }
70 }
71 
72 /*****************************************************************************
73 ** Function name: registerWriteByte
74 ** Description: Write Byte to Register = Set WIN_ID, Write Data
75 ** to Register
76 ** Parameters: Window Number, Register Address, Register Write Byte,
77 ** Verbose Flag
78 ** Return value: None
79 *****************************************************************************/
80 void registerWriteByte(unsigned char winNumber, unsigned char regAddr,
81  unsigned char regByte, unsigned int verbose) {
82  writeByte(ADDR_WIN_CTRL, winNumber, 0);
83  writeByte(regAddr, regByte, 0);
84  if (verbose) {
85  printf("\r\nREG[0x%02X(W%01d)] < 0x%02X\t", regAddr, winNumber, regByte);
86  }
87 }
88 
89 /*****************************************************************************
90 ** Function name: read16
91 ** Description: Read 16-bit from Register (No WIN_ID)
92 ** Parameters: Register Address, Verbose Flag
93 ** Return value: Register Read Value 16-bit
94 *****************************************************************************/
95 unsigned short read16(unsigned char regAddr, unsigned int verbose) {
96  unsigned char response[4] = {0};
97  int size;
98  unsigned char txData[3];
99 
100  // msb is 0b for register reads & address must be even
101  txData[0] = regAddr & 0x7E;
102  txData[1] = 0x00;
103  txData[2] = UART_DELIMITER;
104  writeComPort(txData, 3);
105  epsonStall();
106 
107  // Attempt to read 4 bytes from serial port
108  // Validation check: Should be atleast 4 bytes,
109  // First byte should be Register, Address,
110  // Last byte should be delimiter
111  size = readComPort(&response[0], 4);
112 
113  if ((size < 4) || (response[0] != txData[0]) ||
114  (response[3] != UART_DELIMITER)) {
115  printf("Returned less data or unexpected data from previous command.\n");
116  printf("Return data: 0x%02X, 0x%02X, 0x%02X, 0x%02X\n", response[0],
117  response[1], response[2], response[3]);
118  }
119 
120  if (verbose) {
121  printf("REG[0x%02X] > 0x%02X%02X\t", regAddr, response[1], response[2]);
122  }
123  return (unsigned short)response[1] << 8 | (unsigned short)response[2];
124 }
125 
126 /*****************************************************************************
127 ** Function name: registerRead16
128 ** Description: Read 16-bit from Register
129 ** Parameters: Window Number, Register Address, Verbose Flag
130 ** Return value: Register Read Value 16-bit
131 *****************************************************************************/
132 unsigned short registerRead16(unsigned char winNumber, unsigned char regAddr,
133  unsigned int verbose) {
134  unsigned short rxData;
135 
136  writeByte(ADDR_WIN_CTRL, winNumber, 0);
137  rxData = read16(regAddr, 0);
138  if (verbose) {
139  printf("REG[0x%02X(W%01d)] > 0x%04X\t", regAddr, winNumber, rxData);
140  }
141  return rxData;
142 }
143 
144 /*****************************************************************************
145 ** Function name: sensorDataReadyOptions
146 ** Description: For UART interface check if comport recv buffer
147 ** contains a burst of data based on expected byte length
148 ** from sensorDataByteLength()
149 ** Parameters: None
150 ** Return value: OK or NG
151 *****************************************************************************/
152 int sensorDataReadyOptions(const struct EpsonProperties* esensor,
153  const struct EpsonOptions* options) {
154  seDelayMicroSecs(100);
155  unsigned int count = numBytesReadComPort();
156 
157  if (count >= sensorDataByteLength(esensor, options)) return OK;
158  return NG;
159 }
160 
161 /*****************************************************************************
162 ** Function name: sensorDataScaling
163 ** Description: Retrieves burst data buffer, converts and stores into
164 ** sensor data struct based on settings.
165 ** based on configuration.
166 ** Parameters: pointer to struct describing IMU properties.
167 ** pointer to struct describing IMU settings.
168 ** pointer to struct for converted sensor data.
169 ** Return value: none
170 ** Notes:
171 ******************************************************************************/
172 void sensorDataScaling(const struct EpsonProperties* esensor,
173  const struct EpsonOptions* options,
174  struct EpsonData* data) {
175  // stores the sensor data array index when parsing out data fields
176  int idx = 0;
177 
178  // parsing of data fields applying conversion factor if applicable
179  if (options->flag_out) {
180  unsigned short ndflags = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
181  data->ndflags = ndflags;
182  idx += 2;
183  }
184 
185  if (options->temp_out) {
186  if (options->temp_bit) {
187  // 32-bit calculation
188  int temp = (rxByteBuf[idx] << 8 * 3) + (rxByteBuf[idx + 1] << 8 * 2) +
189  (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
190 
191  if ((esensor->model == G330PDG0) || (esensor->model == G366PDG0) ||
192  (esensor->model == G370PDG0) || (esensor->model == G370PDT0) ||
193  (esensor->model == G570PR20)) {
194  // These models do not have a 25degC temperature offset
195  data->temperature = temp * esensor->tempc_sf_degc / 65536 + 25;
196  } else {
197  data->temperature = (temp - esensor->tempc_25c_offset * 65536) *
198  esensor->tempc_sf_degc / 65536 +
199  25;
200  }
201 
202  idx += 4;
203  } else {
204  // 16-bit calculation
205  short temp = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
206 
207  if ((esensor->model == G330PDG0) || (esensor->model == G366PDG0) ||
208  (esensor->model == G370PDG0) || (esensor->model == G370PDT0) ||
209  (esensor->model == G570PR20)) {
210  // These models do not have a 25degC temperature offset
211  data->temperature = temp * esensor->tempc_sf_degc + 25;
212  } else {
213  data->temperature =
214  (temp - esensor->tempc_25c_offset) * esensor->tempc_sf_degc + 25;
215  }
216 
217  idx += 2;
218  }
219  }
220 
221  if (options->gyro_out) {
222  if (options->gyro_bit) {
223  // 32-bit calculation
224  int gyro_x = (rxByteBuf[idx] << 8 * 3) + (rxByteBuf[idx + 1] << 8 * 2) +
225  (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
226  int gyro_y = (rxByteBuf[idx + 4] << 8 * 3) +
227  (rxByteBuf[idx + 5] << 8 * 2) + (rxByteBuf[idx + 6] << 8) +
228  rxByteBuf[idx + 7];
229  int gyro_z = (rxByteBuf[idx + 8] << 8 * 3) +
230  (rxByteBuf[idx + 9] << 8 * 2) + (rxByteBuf[idx + 10] << 8) +
231  rxByteBuf[idx + 11];
232  data->gyro_x = (esensor->gyro_sf_dps / 65536) * DEG2RAD * gyro_x;
233  data->gyro_y = (esensor->gyro_sf_dps / 65536) * DEG2RAD * gyro_y;
234  data->gyro_z = (esensor->gyro_sf_dps / 65536) * DEG2RAD * gyro_z;
235  idx += 12;
236  } else {
237  // 16-bit calculation
238  short gyro_x = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
239  short gyro_y = (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
240  short gyro_z = (rxByteBuf[idx + 4] << 8) + rxByteBuf[idx + 5];
241  data->gyro_x = esensor->gyro_sf_dps * DEG2RAD * gyro_x;
242  data->gyro_y = esensor->gyro_sf_dps * DEG2RAD * gyro_y;
243  data->gyro_z = esensor->gyro_sf_dps * DEG2RAD * gyro_z;
244  idx += 6;
245  }
246  }
247 
248  if (options->accel_out) {
249  if (options->accel_bit) {
250  // 32-bit calculation
251  int accel_x = (rxByteBuf[idx] << 8 * 3) + (rxByteBuf[idx + 1] << 8 * 2) +
252  (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
253  int accel_y = (rxByteBuf[idx + 4] << 8 * 3) +
254  (rxByteBuf[idx + 5] << 8 * 2) + (rxByteBuf[idx + 6] << 8) +
255  rxByteBuf[idx + 7];
256  int accel_z = (rxByteBuf[idx + 8] << 8 * 3) +
257  (rxByteBuf[idx + 9] << 8 * 2) + (rxByteBuf[idx + 10] << 8) +
258  rxByteBuf[idx + 11];
259  data->accel_x = (esensor->accl_sf_mg / 65536) * MG2MPS2 * accel_x;
260  data->accel_y = (esensor->accl_sf_mg / 65536) * MG2MPS2 * accel_y;
261  data->accel_z = (esensor->accl_sf_mg / 65536) * MG2MPS2 * accel_z;
262  idx += 12;
263  } else {
264  // 16-bit calculation
265  short accel_x = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
266  short accel_y = (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
267  short accel_z = (rxByteBuf[idx + 4] << 8) + rxByteBuf[idx + 5];
268  data->accel_x = (esensor->accl_sf_mg) * MG2MPS2 * accel_x;
269  data->accel_y = (esensor->accl_sf_mg) * MG2MPS2 * accel_y;
270  data->accel_z = (esensor->accl_sf_mg) * MG2MPS2 * accel_z;
271  idx += 6;
272  }
273  }
274 
275  if (options->gyro_delta_out) {
276  double da_sf =
277  esensor->dlta0_sf_deg * (1 << options->dlta_range_ctrl) * DEG2RAD;
278  if (options->gyro_delta_bit) {
279  // 32-bit calculation
280  int gyro_delta_x = (rxByteBuf[idx] << 8 * 3) +
281  (rxByteBuf[idx + 1] << 8 * 2) +
282  (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
283  int gyro_delta_y = (rxByteBuf[idx + 4] << 8 * 3) +
284  (rxByteBuf[idx + 5] << 8 * 2) +
285  (rxByteBuf[idx + 6] << 8) + rxByteBuf[idx + 7];
286  int gyro_delta_z = (rxByteBuf[idx + 8] << 8 * 3) +
287  (rxByteBuf[idx + 9] << 8 * 2) +
288  (rxByteBuf[idx + 10] << 8) + rxByteBuf[idx + 11];
289 
290  data->gyro_delta_x = gyro_delta_x * (da_sf) / 65536;
291  data->gyro_delta_y = gyro_delta_y * (da_sf) / 65536;
292  data->gyro_delta_z = gyro_delta_z * (da_sf) / 65536;
293  idx += 12;
294  } else {
295  // 16-bit calculation
296  short gyro_delta_x = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
297  short gyro_delta_y = (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
298  short gyro_delta_z = (rxByteBuf[idx + 4] << 8) + rxByteBuf[idx + 5];
299  data->gyro_delta_x = gyro_delta_x * (da_sf);
300  data->gyro_delta_y = gyro_delta_y * (da_sf);
301  data->gyro_delta_z = gyro_delta_z * (da_sf);
302  idx += 6;
303  }
304  }
305 
306  if (options->accel_delta_out) {
307  double dv_sf = esensor->dltv0_sf_mps * (1 << options->dltv_range_ctrl);
308  if (options->accel_delta_bit) {
309  // 32-bit calculation
310  int accel_delta_x = (rxByteBuf[idx] << 8 * 3) +
311  (rxByteBuf[idx + 1] << 8 * 2) +
312  (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
313  int accel_delta_y = (rxByteBuf[idx + 4] << 8 * 3) +
314  (rxByteBuf[idx + 5] << 8 * 2) +
315  (rxByteBuf[idx + 6] << 8) + rxByteBuf[idx + 7];
316  int accel_delta_z = (rxByteBuf[idx + 8] << 8 * 3) +
317  (rxByteBuf[idx + 9] << 8 * 2) +
318  (rxByteBuf[idx + 10] << 8) + rxByteBuf[idx + 11];
319  data->accel_delta_x = accel_delta_x * (dv_sf) / 65536;
320  data->accel_delta_y = accel_delta_y * (dv_sf) / 65536;
321  data->accel_delta_z = accel_delta_z * (dv_sf) / 65536;
322  idx += 12;
323  } else {
324  // 16-bit calculation
325  short accel_delta_x = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
326  short accel_delta_y = (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
327  short accel_delta_z = (rxByteBuf[idx + 4] << 8) + rxByteBuf[idx + 5];
328  data->accel_delta_x = accel_delta_x * (dv_sf);
329  data->accel_delta_y = accel_delta_y * (dv_sf);
330  data->accel_delta_z = accel_delta_z * (dv_sf);
331  idx += 6;
332  }
333  }
334 
335  if (options->qtn_out) {
336  if (options->qtn_bit) {
337  // 32-bit calculation
338  int qtn0 = (rxByteBuf[idx] << 8 * 3) + (rxByteBuf[idx + 1] << 8 * 2) +
339  (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
340  int qtn1 = (rxByteBuf[idx + 4] << 8 * 3) + (rxByteBuf[idx + 5] << 8 * 2) +
341  (rxByteBuf[idx + 6] << 8) + rxByteBuf[idx + 7];
342  int qtn2 = (rxByteBuf[idx + 8] << 8 * 3) + (rxByteBuf[idx + 9] << 8 * 2) +
343  (rxByteBuf[idx + 10] << 8) + rxByteBuf[idx + 11];
344  int qtn3 = (rxByteBuf[idx + 12] << 8 * 3) +
345  (rxByteBuf[idx + 13] << 8 * 2) + (rxByteBuf[idx + 14] << 8) +
346  rxByteBuf[idx + 15];
347  data->qtn0 = (double)qtn0 * esensor->qtn_sf / 65536;
348  data->qtn1 = (double)qtn1 * esensor->qtn_sf / 65536;
349  data->qtn2 = (double)qtn2 * esensor->qtn_sf / 65536;
350  data->qtn3 = (double)qtn3 * esensor->qtn_sf / 65536;
351  idx += 16;
352  } else {
353  // 16-bit calculation
354  short qtn0 = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
355  short qtn1 = (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
356  short qtn2 = (rxByteBuf[idx + 4] << 8) + rxByteBuf[idx + 5];
357  short qtn3 = (rxByteBuf[idx + 6] << 8) + rxByteBuf[idx + 7];
358  data->qtn0 = (double)qtn0 * esensor->qtn_sf;
359  data->qtn1 = (double)qtn1 * esensor->qtn_sf;
360  data->qtn2 = (double)qtn2 * esensor->qtn_sf;
361  data->qtn3 = (double)qtn3 * esensor->qtn_sf;
362  idx += 8;
363  }
364  }
365 
366  if (options->atti_out) {
367  if (options->atti_bit) {
368  // 32-bit calculation
369  int ang1 = (rxByteBuf[idx] << 8 * 3) + (rxByteBuf[idx + 1] << 8 * 2) +
370  (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
371  int ang2 = (rxByteBuf[idx + 4] << 8 * 3) + (rxByteBuf[idx + 5] << 8 * 2) +
372  (rxByteBuf[idx + 6] << 8) + rxByteBuf[idx + 7];
373  int ang3 = (rxByteBuf[idx + 8] << 8 * 3) + (rxByteBuf[idx + 9] << 8 * 2) +
374  (rxByteBuf[idx + 10] << 8) + rxByteBuf[idx + 11];
375  data->ang1 = (esensor->ang_sf_deg / 65536) * DEG2RAD * ang1;
376  data->ang2 = (esensor->ang_sf_deg / 65536) * DEG2RAD * ang2;
377  data->ang3 = (esensor->ang_sf_deg / 65536) * DEG2RAD * ang3;
378  idx += 12;
379  } else {
380  // 16-bit calculation
381  short ang1 = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
382  short ang2 = (rxByteBuf[idx + 2] << 8) + rxByteBuf[idx + 3];
383  short ang3 = (rxByteBuf[idx + 4] << 8) + rxByteBuf[idx + 5];
384  data->ang1 = esensor->ang_sf_deg * DEG2RAD * ang1;
385  data->ang2 = esensor->ang_sf_deg * DEG2RAD * ang2;
386  data->ang3 = esensor->ang_sf_deg * DEG2RAD * ang3;
387  idx += 6;
388  }
389  }
390 
391  if (options->gpio_out) {
392  unsigned short gpio = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
393  data->gpio = gpio;
394  idx += 2;
395  }
396 
397  if (options->count_out) {
398  int count = (rxByteBuf[idx] << 8) + rxByteBuf[idx + 1];
399  if (options->ext_sel == 1)
400  data->count = count * esensor->rstcnt_sf_micros;
401  else
402  data->count = count;
403  }
404 }
405 
406 /*****************************************************************************
407 ** Function name: sensorDataReadBurstNOptions
408 ** Description: Retrieves bytes from the incoming IMU stream of UART
409 ** based on expected burst length and searching for START
410 ** and END markers. Then calls sensorDataScaling() to
411 ** post process into struct data.
412 ** Parameters: pointer to struct describing IMU properties.
413 ** pointer to struct describing IMU settings.
414 ** pointer to struct that stores sensor data.
415 ** Return value: OK or NG (checksum error)
416 ** Notes:
417 ******************************************************************************/
419  const struct EpsonOptions* options,
420  struct EpsonData* data) {
421  int byte_length = sensorDataByteLength(esensor, options);
422 
423 #ifdef DEBUG
424  printf("Expecting: %d bytes\n", byte_length);
425 #endif
426 
427  int data_length = byte_length - 2; // exclude the START and END markers
428  unsigned char byte;
429 
430  while (readComPort(&byte, 1) > 0) {
431 #ifdef DEBUG
432  printf("state: %d, byte: 0x%02X\n", state, byte);
433 #endif
434  // State machine to seek out START & END markers and then
435  // call to sensorDataScaling()
436  switch (state) {
437  case START:
438  if (byte == UART_HEADER) state = DATA;
439  break;
440  case DATA:
441  rxByteBuf[data_count] = byte;
442  data_count++;
443  if (data_count == data_length) state = END;
444  break;
445  case END:
446  data_count = 0;
447  state = START;
448  if (byte == UART_DELIMITER) {
449 #ifdef DEBUG
450  for (int i = 0; i < data_length; i++) printf("0x%02X ", rxByteBuf[i]);
451  printf("\n");
452 #endif
453  // If checksum enabled, validate
454  // match = populate sensor data structure
455  // no match = print error msg and skip current sensor burst data
456  if (options->checksum_out == 1) {
457  unsigned short calc_checksum = 0;
458  for (int i = 0; i < data_length - 2; i += 2) {
459  calc_checksum += (rxByteBuf[i] << 8) + rxByteBuf[i + 1];
460  }
461  unsigned short epson_checksum =
462  (rxByteBuf[data_length - 2] << 8) + rxByteBuf[data_length - 1];
463 
464  if (calc_checksum != epson_checksum) {
465  printf("checksum failed\n");
466  return NG;
467  }
468  }
469  sensorDataScaling(esensor, options, data);
470  return OK;
471  }
472  break;
473  default:
474  // Should never get here
475  printf("Invalid State in Read Burst Processing\n");
476  }
477  }
478  // No byte received in serial port yet
479  return NG;
480 }
response
const std::string response
EpsonData::qtn1
double qtn1
Definition: sensor_epsonCommon.h:406
G370PDG0
@ G370PDG0
Definition: sensor_epsonCommon.h:296
EpsonProperties
Definition: sensor_epsonCommon.h:314
seDelayMicroSecs
void seDelayMicroSecs(uint32_t micros)
Definition: hcl_linux.c:58
EpsonOptions::accel_delta_bit
int accel_delta_bit
Definition: sensor_epsonCommon.h:372
EpsonData::ang2
double ang2
Definition: sensor_epsonCommon.h:407
EpsonData::accel_y
double accel_y
Definition: sensor_epsonCommon.h:403
IMUSERIAL
const char * IMUSERIAL
Definition: main_csvlogger.c:41
sensor_epsonCommon.h
EpsonProperties::dlta0_sf_deg
double dlta0_sf_deg
Definition: sensor_epsonCommon.h:325
state
static int state
Definition: sensor_epsonUart.c:39
EpsonOptions::ext_sel
int ext_sel
Definition: sensor_epsonCommon.h:342
rxByteBuf
static unsigned char rxByteBuf[256]
Definition: sensor_epsonUart.c:33
G370PDT0
@ G370PDT0
Definition: sensor_epsonCommon.h:297
registerRead16
unsigned short registerRead16(unsigned char winNumber, unsigned char regAddr, unsigned int verbose)
Definition: sensor_epsonUart.c:132
ADDR_WIN_CTRL
#define ADDR_WIN_CTRL
Definition: sensor_epsonCommon.h:220
writeByte
void writeByte(unsigned char regAddr, unsigned char regByte, unsigned int verbose)
Definition: sensor_epsonUart.c:56
DATA
#define DATA
Definition: sensor_epsonUart.c:37
sensorDataScaling
void sensorDataScaling(const struct EpsonProperties *, const struct EpsonOptions *, struct EpsonData *)
Definition: sensor_epsonUart.c:172
sensor_epsonUart.h
EpsonOptions::temp_bit
int temp_bit
Definition: sensor_epsonCommon.h:368
EpsonData::gyro_delta_z
double gyro_delta_z
Definition: sensor_epsonCommon.h:404
EpsonOptions::gpio_out
int gpio_out
Definition: sensor_epsonCommon.h:363
EpsonOptions
Definition: sensor_epsonCommon.h:340
writeComPort
int writeComPort(unsigned char *bytesToWrite, int size)
Definition: hcl_uart.c:122
EpsonData::accel_delta_y
double accel_delta_y
Definition: sensor_epsonCommon.h:405
EpsonData::gyro_x
double gyro_x
Definition: sensor_epsonCommon.h:402
EpsonData::gyro_delta_y
double gyro_delta_y
Definition: sensor_epsonCommon.h:404
EpsonProperties::dltv0_sf_mps
double dltv0_sf_mps
Definition: sensor_epsonCommon.h:326
hcl.h
EpsonOptions::gyro_bit
int gyro_bit
Definition: sensor_epsonCommon.h:369
EpsonData::temperature
double temperature
Definition: sensor_epsonCommon.h:401
EpsonOptions::qtn_out
int qtn_out
Definition: sensor_epsonCommon.h:360
EpsonOptions::accel_out
int accel_out
Definition: sensor_epsonCommon.h:357
EpsonData::gyro_delta_x
double gyro_delta_x
Definition: sensor_epsonCommon.h:404
UART_HEADER
const unsigned char UART_HEADER
Definition: sensor_epsonUart.c:28
END
#define END
Definition: sensor_epsonUart.c:38
EpsonProperties::qtn_sf
double qtn_sf
Definition: sensor_epsonCommon.h:324
EpsonOptions::count_out
int count_out
Definition: sensor_epsonCommon.h:364
epsonStall
#define epsonStall()
Definition: sensor_epsonSpi.h:32
EpsonData::gpio
unsigned short gpio
Definition: sensor_epsonCommon.h:408
EpsonData::ang1
double ang1
Definition: sensor_epsonCommon.h:407
EpsonData::accel_delta_x
double accel_delta_x
Definition: sensor_epsonCommon.h:405
EpsonData::accel_x
double accel_x
Definition: sensor_epsonCommon.h:403
EpsonOptions::flag_out
int flag_out
Definition: sensor_epsonCommon.h:354
EpsonOptions::checksum_out
int checksum_out
Definition: sensor_epsonCommon.h:365
EpsonData::gyro_z
double gyro_z
Definition: sensor_epsonCommon.h:402
EpsonData
Definition: sensor_epsonCommon.h:399
EpsonOptions::atti_bit
int atti_bit
Definition: sensor_epsonCommon.h:374
EpsonData::ang3
double ang3
Definition: sensor_epsonCommon.h:407
EpsonData::count
int count
Definition: sensor_epsonCommon.h:409
EpsonData::qtn3
double qtn3
Definition: sensor_epsonCommon.h:406
EpsonData::ndflags
unsigned short ndflags
Definition: sensor_epsonCommon.h:400
EpsonProperties::gyro_sf_dps
double gyro_sf_dps
Definition: sensor_epsonCommon.h:318
START
#define START
Definition: sensor_epsonUart.c:36
EpsonProperties::rstcnt_sf_micros
int rstcnt_sf_micros
Definition: sensor_epsonCommon.h:322
sensorDataReadBurstNOptions
int sensorDataReadBurstNOptions(const struct EpsonProperties *esensor, const struct EpsonOptions *options, struct EpsonData *data)
Definition: sensor_epsonUart.c:418
EpsonData::qtn2
double qtn2
Definition: sensor_epsonCommon.h:406
sensorDataReadyOptions
int sensorDataReadyOptions(const struct EpsonProperties *, const struct EpsonOptions *)
Definition: sensor_epsonUart.c:152
EpsonProperties::tempc_sf_degc
double tempc_sf_degc
Definition: sensor_epsonCommon.h:320
MG2MPS2
#define MG2MPS2
Definition: sensor_epsonCommon.h:57
read16
unsigned short read16(unsigned char regAddr, unsigned int verbose)
Definition: sensor_epsonUart.c:95
UART_DELIMITER
const unsigned char UART_DELIMITER
Definition: sensor_epsonUart.c:30
numBytesReadComPort
int numBytesReadComPort(void)
Definition: hcl_uart.c:133
EpsonData::qtn0
double qtn0
Definition: sensor_epsonCommon.h:406
EpsonOptions::atti_out
int atti_out
Definition: sensor_epsonCommon.h:361
EpsonOptions::gyro_delta_out
int gyro_delta_out
Definition: sensor_epsonCommon.h:358
EpsonData::gyro_y
double gyro_y
Definition: sensor_epsonCommon.h:402
EpsonOptions::gyro_out
int gyro_out
Definition: sensor_epsonCommon.h:356
EpsonProperties::accl_sf_mg
double accl_sf_mg
Definition: sensor_epsonCommon.h:319
EpsonOptions::temp_out
int temp_out
Definition: sensor_epsonCommon.h:355
EpsonOptions::dlta_range_ctrl
int dlta_range_ctrl
Definition: sensor_epsonCommon.h:387
EpsonOptions::accel_bit
int accel_bit
Definition: sensor_epsonCommon.h:370
EpsonData::accel_z
double accel_z
Definition: sensor_epsonCommon.h:403
EpsonProperties::model
int model
Definition: sensor_epsonCommon.h:315
EpsonOptions::dltv_range_ctrl
int dltv_range_ctrl
Definition: sensor_epsonCommon.h:388
NG
#define NG
Definition: hcl.h:30
G570PR20
@ G570PR20
Definition: sensor_epsonCommon.h:298
G330PDG0
@ G330PDG0
Definition: sensor_epsonCommon.h:294
sensorDataByteLength
unsigned int sensorDataByteLength(const struct EpsonProperties *esensor, const struct EpsonOptions *options)
Definition: sensor_epsonCommon.c:671
G366PDG0
@ G366PDG0
Definition: sensor_epsonCommon.h:295
EpsonOptions::accel_delta_out
int accel_delta_out
Definition: sensor_epsonCommon.h:359
EpsonOptions::qtn_bit
int qtn_bit
Definition: sensor_epsonCommon.h:373
data_count
static int data_count
Definition: sensor_epsonUart.c:40
EpsonData::accel_delta_z
double accel_delta_z
Definition: sensor_epsonCommon.h:405
DEG2RAD
#define DEG2RAD
Definition: sensor_epsonCommon.h:55
OK
#define OK
Definition: hcl.h:26
EpsonOptions::gyro_delta_bit
int gyro_delta_bit
Definition: sensor_epsonCommon.h:371
EpsonProperties::ang_sf_deg
double ang_sf_deg
Definition: sensor_epsonCommon.h:323
registerWriteByte
void registerWriteByte(unsigned char winNumber, unsigned char regAddr, unsigned char regByte, unsigned int verbose)
Definition: sensor_epsonUart.c:80
EpsonProperties::tempc_25c_offset
int tempc_25c_offset
Definition: sensor_epsonCommon.h:321
readComPort
int readComPort(unsigned char *bytesToRead, int size)
Definition: hcl_uart.c:111
hcl_uart.h


ess_imu_driver
Author(s):
autogenerated on Wed Dec 11 2024 03:06:30