Esempio n. 1
0
void gyroSetup(void) {

    // setup I2C port
    gyroSetupPeripheral();

    // external interrupt configuration.
    // it is NOT USED at this moment.
    ConfigINT1(RISING_EDGE_INT & EXT_INT_DISABLE & EXT_INT_PRI_3);

    dead_zone = DEFAULT_DEAD_ZONE;

    delay_ms(25);   // power up delay, may not need...
    gyroReset();
    delay_ms(10);
    //gyroWrite(REG_DLPF_FS, 0x1A);  // 2000 deg/sec, 1 kHz Sampling rate, 98Hz LPF
    gyroWrite(REG_DLPF_FS, 0x19);  // 2000 deg/sec, 1 kHz Sampling rate, 196Hz LPF
    gyroWrite(REG_INT_CFG, 0x00);  // interrupt disabled
    gyroWrite(REG_PWR_MGM, 0x03);  // Set power management?
    delay_ms(1);   // PLL Settling time

    is_ready = 1;

    delay_ms(6); //From datasheet, standard settling time
    gyroRunCalib(INITIAL_CALIB_NUM);  // quick calibration

}
Esempio n. 2
0
void gyroSetup(void) {
    
    // setup I2C port
    gyroSetupPeripheral();

    // external interrupt configuration. 
    // it is NOT USED at this moment.
    ConfigINT1(RISING_EDGE_INT & EXT_INT_DISABLE & EXT_INT_PRI_3); 

    delay_ms(25);   // power up delay, may not need...
    //gyroWrite(0x16, 0x1A);  // 2000 deg/sec, 1 kHz Sampling rate, 98Hz LPF
    gyroWrite(0x16, 0x19);  // 2000 deg/sec, 1 kHz Sampling rate, 196Hz LPF
    gyroWrite(0x17, 0x00);  // interrupt disabled
    gyroWrite(0x3e, 0x03);
    delay_ms(1);   // PLL Settling time

    gyroRunCalib(100);  // quick calibration. better to run this with > 1000.

}