30 unsigned int debug =
FALSE;
31 unsigned short rxData;
32 unsigned short retryCount = 3000;
48 }
while((rxData & 0x0400) == 0x0400 && (retryCount != 0));
52 printf(
"\r\n...Error: NOT_READY stuck HIGH.");
68 unsigned short rxData = 0xFFFF;
69 unsigned int debug =
FALSE;
70 unsigned short retryCount = 3000;
79 }
while((rxData & 0x0400) == 0x0000 && (retryCount != 0));
83 printf(
"\r\n...Error: Stuck in Sampling Mode.");
109 unsigned int debug =
FALSE;
112 printf(
"\r\n...Sensor start.");
124 unsigned int debug =
FALSE;
128 printf(
"\r\n...Sensor stop.");
140 unsigned int debug =
FALSE;
142 printf(
"\r\n...Software Reset begin.");
145 printf(
"\r\n...Software Reset complete.");
158 unsigned int debug =
FALSE;
159 unsigned short rxData;
160 unsigned short retryCount = 3000;
162 printf(
"\r\n...Flash test begin.");
169 }
while((rxData & 0x0800) == 0x0800 && (retryCount != 0));
172 printf(
"\r\n...Error: Flashtest bit did not retrun to 0b.");
177 printf(
"\r\n...Flash test complete.");
179 if ((rxData & 0x0004) == 0x0000)
195 unsigned int debug =
FALSE;
196 unsigned short rxData;
197 unsigned short retryCount = 3000;
199 printf(
"\r\n...Self test begin.");
206 }
while((rxData & 0x0400) == 0x0400 && (retryCount != 0));
209 printf(
"\r\n...Error: Self test bit did not return to 0b.");
214 printf(
"\r\n...Self test complete.");
216 if ((rxData & 0x0002) == 0x0000)
237 void ppSensorDataRead32N(
double ppSensorReadData[],
signed short sensorReadData[],
unsigned char startIndex)
239 ppSensorReadData[0] = ((sensorReadData[startIndex] << 16) + sensorReadData[startIndex + 1]) *
EPSON_GYRO_SF/65536;
240 ppSensorReadData[1] = ((sensorReadData[startIndex + 2] << 16) + sensorReadData[startIndex + 3]) *
EPSON_GYRO_SF/65536;
241 ppSensorReadData[2] = ((sensorReadData[startIndex + 4] << 16) + sensorReadData[startIndex + 5]) *
EPSON_GYRO_SF/65536;
243 ppSensorReadData[3] = ((sensorReadData[startIndex + 6] << 16) + sensorReadData[startIndex + 7]) *
EPSON_ACCL_SF/65536;
244 ppSensorReadData[4] = ((sensorReadData[startIndex + 8] << 16) + sensorReadData[startIndex + 9]) *
EPSON_ACCL_SF/65536;
245 ppSensorReadData[5] = ((sensorReadData[startIndex + 10] << 16) + sensorReadData[startIndex + 11]) *
EPSON_ACCL_SF/65536;
262 void ppSensorDataRead16N(
double ppSensorReadData[],
signed short sensorReadData[],
unsigned char startIndex)
264 ppSensorReadData[0] = (sensorReadData[startIndex]) *
EPSON_GYRO_SF;
265 ppSensorReadData[1] = (sensorReadData[startIndex + 1]) *
EPSON_GYRO_SF;
266 ppSensorReadData[2] = (sensorReadData[startIndex + 2]) *
EPSON_GYRO_SF;
268 ppSensorReadData[3] = (sensorReadData[startIndex + 3]) *
EPSON_ACCL_SF;
269 ppSensorReadData[4] = (sensorReadData[startIndex + 4]) *
EPSON_ACCL_SF;
270 ppSensorReadData[5] = (sensorReadData[startIndex + 5]) *
EPSON_ACCL_SF;
286 unsigned short calChecksum16(
unsigned short sensorReadData[],
unsigned int endOffset)
289 unsigned short chksum16_calc = 0;
291 for (i = 0; i < endOffset; i++)
292 chksum16_calc += sensorReadData[i];
294 return chksum16_calc;
#define DELAY_EPSON_RESET
#define EPSON_POWER_ON_DELAY
int sensorFlashTest(void)
void gpioSet(uint8_t pin)
#define EPSON_SELF_TEST_DELAY
#define ADDR_MODE_CTRL_HI
#define EPSON_FLASH_TEST_DELAY
#define ADDR_MODE_CTRL_LO
void seDelayMicroSecs(uint32_t micros)
unsigned short registerRead16(unsigned char, unsigned char, unsigned int)
void registerWriteByte(unsigned char, unsigned char, unsigned char, unsigned int)
void gpioClr(uint8_t pin)
unsigned short calChecksum16(unsigned short sensorReadData[], unsigned int endOffset)
void ppSensorDataRead32N(double ppSensorReadData[], signed short sensorReadData[], unsigned char startIndex)
void seDelayMS(uint32_t millis)
void ppSensorDataRead16N(double ppSensorReadData[], signed short sensorReadData[], unsigned char startIndex)
#define CMD_BEGIN_SAMPLING