27 #define EPSON_STALL 134 // Microseconds
81 unsigned int verbose) {
82 unsigned char txData[3];
84 txData[0] = regAddr | 0x80;
91 printf(
"\r\nREG[0x%02X] < 0x%02X\t", regAddr, regByte);
106 unsigned char regByte,
unsigned int verbose) {
107 #if !(defined G350 || defined V340PDD0)
108 unsigned char txData[3];
111 txData[1] = winNumber;
129 unsigned char txData[3];
146 if ((size < 4) || (
response[0] != txData[0]) ||
148 printf(
"Returned less data or unexpected data from previous command.\n");
149 printf(
"Return data: 0x%02X, 0x%02X, 0x%02X, 0x%02X\n",
response[0],
168 unsigned int verbose) {
169 #if !(defined G350 || defined V340PDD0)
170 unsigned char txData[3];
173 txData[1] = winNumber;
263 epson_data->
gpio = gpio;
272 printf(
"ndflag: %04x\t", epson_data->
ndflags);
280 #if defined G330PDG0 || defined G366PDG0 || defined G370PDG0 || defined G370PDT0
284 #endif // defined G330PDG0 || defined G366PDG0 || defined G370PDG0 || defined
289 #if defined G330PDG0 || defined G366PDG0 || defined G370PDG0 || defined G370PDT0
293 #endif // defined G330PDG0 || defined G366PDG0 || defined G370PDG0 || defined
306 int gyro_y = (
rxByteBuf[idx + 4] << 8 * 3) +
309 int gyro_z = (
rxByteBuf[idx + 8] << 8 * 3) +
326 printf(
"gx: %8.5f\tgy: %8.5f\tgz: %8.5f\t",
327 epson_data->
gyro_x * 180.0 / 3.14159,
328 epson_data->
gyro_y * 180.0 / 3.14159,
329 epson_data->
gyro_z * 180.0 / 3.14159);
337 int accel_y = (
rxByteBuf[idx + 4] << 8 * 3) +
340 int accel_z = (
rxByteBuf[idx + 8] << 8 * 3) +
360 printf(
"ax: %8.5f\tay: %8.5f\taz: %8.5f\t",
361 epson_data->
accel_x * 1000 / 9.80665,
362 epson_data->
accel_y * 1000 / 9.80665,
363 epson_data->
accel_z * 1000 / 9.80665);
369 int gyro_delta_x = (
rxByteBuf[idx] << 8 * 3) +
372 int gyro_delta_y = (
rxByteBuf[idx + 4] << 8 * 3) +
375 int gyro_delta_z = (
rxByteBuf[idx + 8] << 8 * 3) +
379 epson_data->
gyro_delta_x = gyro_delta_x * (da_sf) / 65536;
380 epson_data->
gyro_delta_y = gyro_delta_y * (da_sf) / 65536;
381 epson_data->
gyro_delta_z = gyro_delta_z * (da_sf) / 65536;
394 printf(
"dax: %8.5f\tday: %8.5f\tdaz: %8.5f\t", epson_data->
gyro_delta_x,
401 int accel_delta_x = (
rxByteBuf[idx] << 8 * 3) +
404 int accel_delta_y = (
rxByteBuf[idx + 4] << 8 * 3) +
407 int accel_delta_z = (
rxByteBuf[idx + 8] << 8 * 3) +
426 printf(
"dvx: %8.5f\tdvy: %8.5f\tdvz: %8.5f\t", epson_data->
accel_delta_x,
439 int qtn3 = (
rxByteBuf[idx + 12] << 8 * 3) +
442 epson_data->
qtn0 = (double)qtn0 / 1073741824;
443 epson_data->
qtn1 = (double)qtn1 / 1073741824;
444 epson_data->
qtn2 = (double)qtn2 / 1073741824;
445 epson_data->
qtn3 = (double)qtn3 / 1073741824;
452 epson_data->
qtn0 = (double)qtn0 / 16384;
453 epson_data->
qtn1 = (double)qtn1 / 16384;
454 epson_data->
qtn2 = (double)qtn2 / 16384;
455 epson_data->
qtn3 = (double)qtn3 / 16384;
459 printf(
"qtn0: %8.5f\tqtn1: %8.5f\tqtn2: %8.5f\tqtn3: %8.5f\t",
469 int pitch = (
rxByteBuf[idx + 4] << 8 * 3) +
488 printf(
"roll: %8.3f\tpitch: %8.3f\tyaw: %8.3f\t",
489 epson_data->
roll * 180.0 / 3.14159,
490 epson_data->
pitch * 180.0 / 3.14159,
491 epson_data->
yaw * 180.0 / 3.14159);
497 epson_data->
gpio = gpio;
500 printf(
"gpio: %04x\t", epson_data->
gpio);
510 epson_data->
count = count;
512 printf(
"count: %09d\t", epson_data->
count);
533 printf(
"Expecting: %d bytes\n", byte_length);
536 int data_length = byte_length - 2;
559 for (
int i = 0; i < data_length; i++) printf(
"0x%02X ",
rxByteBuf[i]);
573 unsigned short checksum = 0;
574 for (
int i = 0; i < data_length - 2; i += 2) {
577 unsigned short epson_checksum =
580 if (checksum == epson_checksum) {
585 printf(
"\nScaling Data");
589 printf(
"checksum NG\n");
596 printf(
"Invalid State in Read Burst Processing\n");