Beispiel #1
0
static void cmd_fullscale(BaseSequentialStream *chp, int argc, char *argv[]) {
  (void)argv;
  if (argc != 1) {
    chprintf(chp, "Usage: fullscale [2G|4G|6G|8G|16G]\r\n");
    return;
  }
#if CHPRINTF_USE_ANSI_CODE
    chprintf(chp, "\033[2J\033[1;1H");
#endif
  if(!strcmp (argv[0], "2G")) {
    accelerometerSetFullScale(&LIS3DSHD1, LIS3DSH_FS_2G);
    chprintf(chp, "LIS3DSH Accelerometer full scale set to 2G...\r\n");
  }
  else if(!strcmp (argv[0], "4G")) {
    accelerometerSetFullScale(&LIS3DSHD1, LIS3DSH_FS_4G);
    chprintf(chp, "LIS3DSH Accelerometer full scale set to 4G...\r\n");
  }
  else if(!strcmp (argv[0], "6G")) {
    accelerometerSetFullScale(&LIS3DSHD1, LIS3DSH_FS_6G);
    chprintf(chp, "LIS3DSH Accelerometer full scale set to 6G...\r\n");
  }
  else if(!strcmp (argv[0], "8G")) {
    accelerometerSetFullScale(&LIS3DSHD1, LIS3DSH_FS_8G);
    chprintf(chp, "LIS3DSH Accelerometer full scale set to 8G...\r\n");
  }
  else if(!strcmp (argv[0], "16G")) {
    accelerometerSetFullScale(&LIS3DSHD1, LIS3DSH_FS_16G);
    chprintf(chp, "LIS3DSH Accelerometer full scale set to 16G...\r\n");
  }
  else {
    chprintf(chp, "Usage: fullscale [2G|4G|6G|8G|16G]\r\n");
    return;
  }
}
Beispiel #2
0
static void cmd_fullscale(BaseSequentialStream *chp, int argc, char *argv[]) {
  (void)argv;
  if (argc < 1) {
    chprintf(chp, "Usage: fullscale [acc|gyro] [value]\r\n");
    return;
  }
  if (!strcmp (argv[0], "acc")) {
#if CHPRINTF_USE_ANSI_CODE
      chprintf(chp, "\033[2J\033[1;1H");
#endif
    if(!strcmp (argv[1], "2G")) {
      accelerometerSetFullScale(&LSM6DS0D1, LSM6DS0_ACC_FS_2G);
      chprintf(chp, "LSM6DS0 Accelerometer full scale set to 2G...\r\n");
    }
    else if(!strcmp (argv[1], "4G")) {
      accelerometerSetFullScale(&LSM6DS0D1, LSM6DS0_ACC_FS_4G);
      chprintf(chp, "LSM6DS0 Accelerometer full scale set to 4G...\r\n");
    }
    else if(!strcmp (argv[1], "8G")) {
      accelerometerSetFullScale(&LSM6DS0D1, LSM6DS0_ACC_FS_8G);
      chprintf(chp, "LSM6DS0 Accelerometer full scale set to 8G...\r\n");
    }
    else if(!strcmp (argv[1], "16G")) {
      accelerometerSetFullScale(&LSM6DS0D1, LSM6DS0_ACC_FS_16G);
      chprintf(chp, "LSM6DS0 Accelerometer full scale set to 16G...\r\n");
    }
    else {
      chprintf(chp, "Usage: fullscale acc [2G|4G|8G|16G]\r\n");
      return;
    }
  }
  else if (!strcmp (argv[0], "gyro")) {
#if CHPRINTF_USE_ANSI_CODE
      chprintf(chp, "\033[2J\033[1;1H");
#endif
      if(!strcmp (argv[1], "245")) {
        gyroscopeSetFullScale(&LSM6DS0D1, LSM6DS0_GYRO_FS_245DPS);
        chprintf(chp, "LSM6DS0 Gyroscope full scale set to 245 DPS...\r\n");
      }
      else if(!strcmp (argv[1], "500")) {
        gyroscopeSetFullScale(&LSM6DS0D1, LSM6DS0_GYRO_FS_500DPS);
        chprintf(chp, "LSM6DS0 Gyroscope full scale set to 500 DPS...\r\n");
      }
      else if(!strcmp (argv[1], "2000")) {
        gyroscopeSetFullScale(&LSM6DS0D1, LSM6DS0_GYRO_FS_2000DPS);
        chprintf(chp, "LSM6DS0 Gyroscope full scale set to 2000 DPS...\r\n");
      }
      else {
        chprintf(chp, "Usage: fullscale gyro [245|500|2000]\r\n");
        return;
      }
  }
  else {
    chprintf(chp, "Usage: fullscale [acc|gyro] [value]\r\n");
    return;
  }
}
Beispiel #3
0
static void cmd_fullscale(BaseSequentialStream *chp, int argc, char *argv[]) {
  (void)argv;
  if (argc < 1) {
    chprintf(chp, "Usage: fullscale [acc|comp] [value]\r\n");
    return;
  }
  if (!strcmp (argv[0], "acc")) {
#if CHPRINTF_USE_ANSI_CODE
      chprintf(chp, "\033[2J\033[1;1H");
#endif
    if(!strcmp (argv[1], "2G")) {
      accelerometerSetFullScale(&LSM303DLHCD1, LSM303DLHC_ACC_FS_2G);
      chprintf(chp, "LSM303DLHC Accelerometer full scale set to 2G...\r\n");
    }
    else if(!strcmp (argv[1], "4G")) {
      accelerometerSetFullScale(&LSM303DLHCD1, LSM303DLHC_ACC_FS_4G);
      chprintf(chp, "LSM303DLHC Accelerometer full scale set to 4G...\r\n");
    }
    else if(!strcmp (argv[1], "8G")) {
      accelerometerSetFullScale(&LSM303DLHCD1, LSM303DLHC_ACC_FS_8G);
      chprintf(chp, "LSM303DLHC Accelerometer full scale set to 8G...\r\n");
    }
    else if(!strcmp (argv[1], "16G")) {
      accelerometerSetFullScale(&LSM303DLHCD1, LSM303DLHC_ACC_FS_16G);
      chprintf(chp, "LSM303DLHC Accelerometer full scale set to 16G...\r\n");
    }
    else {
      chprintf(chp, "Usage: fullscale acc [2G|4G|8G|16G]\r\n");
      return;
    }
  }
  else if (!strcmp (argv[0], "comp")) {
#if CHPRINTF_USE_ANSI_CODE
      chprintf(chp, "\033[2J\033[1;1H");
#endif
      if(!strcmp (argv[1], "1.3")) {
        compassSetFullScale(&LSM303DLHCD1, LSM303DLHC_COMP_FS_1P3GA);
        chprintf(chp, "LSM303DLHC Compass full scale set to 1.3 Gauss...\r\n");
      }
      else if(!strcmp (argv[1], "1.9")) {
        compassSetFullScale(&LSM303DLHCD1, LSM303DLHC_COMP_FS_1P9GA);
        chprintf(chp, "LSM303DLHC Compass full scale set to 1.9 Gauss...\r\n");
      }
      else if(!strcmp (argv[1], "2.5")) {
        compassSetFullScale(&LSM303DLHCD1, LSM303DLHC_COMP_FS_2P5GA);
        chprintf(chp, "LSM303DLHC Compass full scale set to 2.5 Gauss...\r\n");
      }
      else if(!strcmp (argv[1], "4.0")) {
        compassSetFullScale(&LSM303DLHCD1, LSM303DLHC_COMP_FS_4P0GA);
        chprintf(chp, "LSM303DLHC Compass full scale set to 4.0 Gauss...\r\n");
      }
      else if(!strcmp (argv[1], "4.7")) {
        compassSetFullScale(&LSM303DLHCD1, LSM303DLHC_COMP_FS_4P7GA);
        chprintf(chp, "LSM303DLHC Compass full scale set to 4.7 Gauss...\r\n");
      }
      else if(!strcmp (argv[1], "5.6")) {
        compassSetFullScale(&LSM303DLHCD1, LSM303DLHC_COMP_FS_5P6GA);
        chprintf(chp, "LSM303DLHC Compass full scale set to 5.6 Gauss...\r\n");
      }
      else if(!strcmp (argv[1], "8.1")) {
        compassSetFullScale(&LSM303DLHCD1, LSM303DLHC_COMP_FS_8P1GA);
        chprintf(chp, "LSM303DLHC Compass full scale set to 8.1 Gauss...\r\n");
      }
      else {
        chprintf(chp, "Usage: fullscale comp [1.3|1.9|2.5|4.0|4.7|5.6|8.1]\r\n");
        return;
      }
  }
  else {
    chprintf(chp, "Usage: fullscale [acc|comp] [value]\r\n");
    return;
  }
}