Ejemplo n.º 1
0
        private void setGyroFullScaleRange(GyroFullScale gfs)
        {
            //  * 0 = +/- 250 degrees/sec
            //  * 1 = +/- 500 degrees/sec
            //  * 2 = +/- 1000 degrees/sec
            //  * 3 = +/- 2000 degrees/sec

            // bit 4 len 2
            this.WriteBits(Register.GYRO_CONFIG, 4, 2, Convert.ToByte(gfs));
            Hardware.Library.Delay(10);
        }
Ejemplo n.º 2
0
        private static float get_gRes(GyroFullScale gscale)
        {
            switch (gscale)
            {
            // Possible gyro scales (and their register bit settings) are:
            // 250 DPS (00), 500 DPS (01), 1000 DPS (10), and 2000 DPS  (11).
            case GyroFullScale.GFS_250DPS:
                return(250.0f / 32768.0f);

            case GyroFullScale.GFS_500DPS:
                return(500.0f / 32768.0f);

            case GyroFullScale.GFS_1000DPS:
                return(1000.0f / 32768.0f);

            case GyroFullScale.GFS_2000DPS:
                return(2000.0f / 32768.0f);

            default:
                throw new Exception("get_aRes error");
            }
        }