sys/shell: removed shell cmds for SAULified sensors
- isl29020 - l3g4200d - lps331ap - lsm303dlhccc430
parent
84a094d092
commit
7accaa7b74
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_shell_commands
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Provides shell commands to poll the ISL29020 sensor
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "isl29020.h"
|
||||
|
||||
#ifdef MODULE_ISL29020
|
||||
|
||||
#define MODE ISL29020_MODE_AMBIENT
|
||||
#define RANGE ISL29020_RANGE_16K
|
||||
|
||||
static isl29020_t isl29020_dev;
|
||||
|
||||
int _get_isl29020_init_handler(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
int res;
|
||||
|
||||
res = isl29020_init(&isl29020_dev, ISL29020_I2C, ISL29020_ADDR, RANGE, MODE);
|
||||
|
||||
if (res) {
|
||||
puts("Error initializing ISL29020 sensor.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
puts("Initialized ISL29020 sensor with default values");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int _get_isl29020_read_handler(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
int val;
|
||||
|
||||
if (!isl29020_dev.address) {
|
||||
puts("Error: please call `isl29020_init` first!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
val = isl29020_read(&isl29020_dev);
|
||||
if (val < 0) {
|
||||
puts("Error reading brightness value from ISL29020.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("ISL29020: brightness %i LUX\n", val);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MODULE_ISL29020 */
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_shell_commands
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Provides shell commands to poll the L3G4200D sensor
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "l3g4200d.h"
|
||||
|
||||
#ifdef MODULE_L3G4200D
|
||||
|
||||
#define MODE L3G4200D_MODE_100_25
|
||||
#define SCALE L3G4200D_SCALE_500DPS
|
||||
|
||||
static l3g4200d_t l3g4200d_dev;
|
||||
|
||||
int _get_l3g4200d_init_handler(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
int res;
|
||||
|
||||
res = l3g4200d_init(&l3g4200d_dev, L3G4200D_I2C, L3G4200D_ADDR,
|
||||
L3G4200D_INT, L3G4200D_DRDY,
|
||||
MODE, SCALE);
|
||||
|
||||
if (res) {
|
||||
puts("Error initializing L3G4200D sensor.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
puts("Initialized L3G4200D sensor with default values");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int _get_l3g4200d_read_handler(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
int res;
|
||||
l3g4200d_data_t data;
|
||||
|
||||
if (!l3g4200d_dev.addr) {
|
||||
puts("Error: please call `l3g4200d_init` first!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
res = l3g4200d_read(&l3g4200d_dev, &data);
|
||||
if (res < 0) {
|
||||
puts("Error reading gyro values from L3G4200D.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("L3G4200D: gyro values: roll(x): %6i pitch(y): %6i yaw(z): %6i\n",
|
||||
data.acc_x, data.acc_y, data.acc_z);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MODULE_L3G4200D */
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_shell_commands
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Provides shell commands to poll the LPS331AP sensor
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "lps331ap.h"
|
||||
|
||||
#ifdef MODULE_LPS331AP
|
||||
|
||||
#define RATE LPS331AP_RATE_7HZ
|
||||
|
||||
static lps331ap_t lps331ap_dev;
|
||||
|
||||
int _get_lps331ap_init_handler(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
int res;
|
||||
|
||||
res = lps331ap_init(&lps331ap_dev, LPS331AP_I2C, LPS331AP_ADDR, RATE);
|
||||
|
||||
if (res) {
|
||||
puts("Error initializing LPS331AP sensor.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
puts("Initialized LPS331AP sensor with default values");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int _get_lps331ap_read_handler(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
int temp;
|
||||
int pres;
|
||||
|
||||
if (!lps331ap_dev.address) {
|
||||
puts("Error: please call `lps331ap_init` first!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
temp = lps331ap_read_temp(&lps331ap_dev);
|
||||
pres = lps331ap_read_pres(&lps331ap_dev);
|
||||
|
||||
if (temp < 0) {
|
||||
puts("Error reading temperature value from LPS331AP.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
int temp_abs = temp / 1000;
|
||||
temp -= (temp_abs * 1000);
|
||||
printf("LPS331AP: temperature: %i.%03i °C\n", temp_abs, temp);
|
||||
}
|
||||
|
||||
if (pres < 0) {
|
||||
puts("Error reading pressure value from LPS331AP.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("LPS331AP: pressure: %i mBar\n", pres);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* MODULE_LPS331AP */
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_shell_commands
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Provides shell commands to poll lsm303dlhc sensor
|
||||
*
|
||||
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
#include "lsm303dlhc.h"
|
||||
|
||||
#ifdef MODULE_LSM303DLHC
|
||||
|
||||
#define ACC_S_RATE LSM303DLHC_ACC_SAMPLE_RATE_10HZ
|
||||
#define ACC_SCALE LSM303DLHC_ACC_SCALE_2G
|
||||
#define MAG_S_RATE LSM303DLHC_MAG_SAMPLE_RATE_75HZ
|
||||
#define MAG_GAIN LSM303DLHC_MAG_GAIN_400_355_GAUSS
|
||||
|
||||
static lsm303dlhc_t lsm303_dev;
|
||||
|
||||
int _get_lsm303dlhc_init_handler(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
uint8_t error;
|
||||
|
||||
error = lsm303dlhc_init(&lsm303_dev, LSM303DLHC_I2C,
|
||||
LSM303DLHC_INT1, LSM303DLHC_DRDY,
|
||||
LSM303DLHC_ACC_ADDR, ACC_S_RATE, ACC_SCALE,
|
||||
LSM303DLHC_MAG_ADDR, MAG_S_RATE, MAG_GAIN);
|
||||
|
||||
if (error) {
|
||||
puts("Error initializing lsm303dlhc sensor.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
puts("Initialized lsm303dlhc sensor with default values");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int _get_lsm303dlhc_read_handler(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
uint8_t error;
|
||||
lsm303dlhc_3d_data_t data;
|
||||
|
||||
if (!lsm303_dev.acc_address || !lsm303_dev.mag_address) {
|
||||
puts("Error: please call `lsm303dlhc_init` first!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
error = lsm303dlhc_read_acc(&lsm303_dev, &data);
|
||||
if (error) {
|
||||
puts("Error reading accelerometer data from lsm303dlhc.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("lsm303dlhc: Accelerometer {%i, %i, %i} mg\n", data.x_axis, data.y_axis, data.z_axis);
|
||||
}
|
||||
|
||||
error = lsm303dlhc_read_mag(&lsm303_dev, &data);
|
||||
if (error) {
|
||||
puts("Error reading magnetometer data from lsm303dlhc.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("lsm303dlhc: Magnetometer {%i, %i, %i}/1100 gauss\n", data.x_axis, data.y_axis, data.z_axis);
|
||||
}
|
||||
|
||||
error = lsm303dlhc_read_temp(&lsm303_dev, &(data.x_axis));
|
||||
if (error) {
|
||||
puts("Error reading temperature data from lsm303dlhc.");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("lsm303dlhc: Temperature %i\n", data.x_axis);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MODULE_LSM303DLHC */
|
Loading…
Reference in New Issue