Beispiel #1
0
void gyroReadTemp(void) {
    unsigned char temp_data[2];

    gyroStartTx();
    gyroSendByte(GYRO_ADDR_WR);
    gyroSendByte(REG_TEMP_OUT_H);
    gyroEndTx();
    gyroStartTx();
    gyroSendByte(GYRO_ADDR_RD);
    gyroReadString(2, temp_data, I2C_TIMEOUT_BYTES);
    gyroEndTx();

    GyroData.chr_data[0] = temp_data[1];
    GyroData.chr_data[1] = temp_data[0];
}
Beispiel #2
0
void gyroReadTemp(void) {
    unsigned char temp_data[2];

    gyroStartTx();
    gyroSendByte(GYRO_ADDR_WR);
    gyroSendByte(0x1b);
    gyroEndTx();
    gyroStartTx();
    gyroSendByte(GYRO_ADDR_RD);
    gyroReadString(2, temp_data, 1000);
    gyroEndTx();

    GyroData.chr_data[0] = temp_data[1];
    GyroData.chr_data[1] = temp_data[0];
}
Beispiel #3
0
unsigned char* gyroReadXYZ(void) {
    unsigned char gyro_data[6];
    gyroStartTx();
    gyroSendByte(GYRO_ADDR_WR);
    gyroSendByte(0x1d);
    gyroEndTx();
    gyroStartTx();
    gyroSendByte(GYRO_ADDR_RD);
    gyroReadString(6, gyro_data, I2C_TIMEOUT_BYTES);
    gyroEndTx();

    GyroData.chr_data[2] = gyro_data[1];
    GyroData.chr_data[3] = gyro_data[0];
    GyroData.chr_data[4] = gyro_data[3];
    GyroData.chr_data[5] = gyro_data[2];
    GyroData.chr_data[6] = gyro_data[5];
    GyroData.chr_data[7] = gyro_data[4];

    return GyroData.chr_data + 2;
}
Beispiel #4
0
void gyroGetXYZ(unsigned char *data) {

    unsigned char gyro_data[6];
    gyroStartTx();
    gyroSendByte(GYRO_ADDR_WR);
    gyroSendByte(0x1d);
    gyroEndTx();
    gyroStartTx();
    gyroSendByte(GYRO_ADDR_RD);
    gyroReadString(6, gyro_data, 1000);
    gyroEndTx();

    data[0] = gyro_data[1];
    data[1] = gyro_data[0];    
    data[2] = gyro_data[3];
    data[3] = gyro_data[2];    
    data[4] = gyro_data[5];    
    data[5] = gyro_data[4];

}