readDigitalSensorRaw - VCSFA-MARS/TSLPB GitHub Wiki

Overview

This API returns the raw value from the specified sensor. Handles endianness and discarding unused bits.

uint16_t TSLPB::readDigitalSensorRaw(TSLPB_DigitalSensor_t sensorName)

Returns

a uint16_t containing the bit pattern from the sensor's register.

Arguments

sensorName : TSLPB_DigitalSensor_t Sensor Name enum

TSLPB_DigitalSensor_t is an enum of all the built-in digital sensors on the TSLPB

typedef enum
{
    DT1,                            ///< Select LM75A DT1
    DT2,                            ///< Select LM75A DT2
    DT3,                            ///< Select LM75A DT3
    DT4,                            ///< Select LM75A DT4
    DT5,                            ///< Select LM75A DT5
    DT6,                            ///< Select LM75A DT6
    Accelerometer_x,                ///< Select MPU-9250 Accelerometer x-axis
    Accelerometer_y,                ///< Select MPU-9250 Accelerometer y-axis
    Accelerometer_z,                ///< Select MPU-9250 Accelerometer z-axis
    Gyroscope_x,                    ///< Select MPU-9250 Gyroscope x-axis
    Gyroscope_y,                    ///< Select MPU-9250 Gyroscope y-axis
    Gyroscope_z,                    ///< Select MPU-9250 Gyroscope z-axis
    Magnetometer_x,                 ///< Select MPU-9250 Magnetometer x-axis
    Magnetometer_y,                 ///< Select MPU-9250 Magnetometer y-axis
    Magnetometer_z,                 ///< Select MPU-9250 Magnetometer z-axis
    IMU_Internal_Temp               ///< Select MPU-9250 Internal Temperature
} TSLPB_DigitalSensor_t;

Usage

TSLPB tslpb;
uint16_t gyroXraw = tslpb.readDigitalSensorRaw(Gyroscope_x);