Sensors Tlera Documentation¶
This is the main library of the project and is comoposed by two files:
- SensorsTlera.h
Header of the main class.
- SensorsTlera.cpp
Source file of the main class.
Those files describes a class which is SensorsTlera
and
declare some structs which are useful to manage data from sensors.
Those declarations could be divided in two groups, the mangnitud structs
and the sensor type structs which are explanined as follows.
1. Type declarations¶
1.1. Magnitude type declarations¶
These declarations are centered on the type of magnitude measured by sensors.
1.1.1. Acelerometer type¶
-
struct
accel_t
¶ Acceleration type.
Public Functions
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast data to bytes.
The resulting array is:
[ax1, ax2, ay1, ay2, az1, az2]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
AX:axvalue;AY:ayvalue;AZ:azvalue
-
1.1.2. Gyroscope type¶
-
struct
gyro_t
¶ Gyroscopo type.
Public Functions
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast data to bytes.
The resulting array is:
[avx1, avx2, avy1, avy2, avz1, avz2]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
AVX:avxvalue;AVY:avyvalue;AVZ:avzvalue
-
1.1.3. Magnetometer type¶
-
struct
mag_t
¶ Magnetometer type.
Public Functions
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast data to bytes.
The resulting array is:
[mx1, mx2, my1, my2, mz1, mz2]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
MX:mxvalue;MY:myvalue;MZ:mzvalue
-
1.1.4. Temperature type¶
-
struct
temp_t
¶ Temperature type.
Public Functions
-
operator int16_t
()¶ Operator to convert into uint16_t value.
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast temperature to bytes.
The resulting array is:
[tempc1, tempc2]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
TEMPC:tempcvalue;TEMPF:tempfvalue
-
1.1.5. Humidity type¶
-
struct
hum_t
¶ Humidity type.
Public Functions
-
operator int16_t
()¶ Operator to convert into uint16_t value.
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast humidity value to bytes.
The resulting array is:
[hum1, hum2]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
HUM:humidityvalue
-
1.1.6. Pressure type¶
-
struct
press_t
¶ Pressure type.
Public Functions
-
operator int16_t
()¶ Operator to convert into uint16_t value.
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast pressure value to bytes.
The resulting array is:
[altitude_mts1, altitude_mts2]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
PRESS:pressure_mbar;ALTITUDE:altitude_mts
-
1.1.7. Battery type¶
-
struct
batt_t
¶ Battery type.
Public Functions
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
VBAT:vbatvalue
-
operator int16_t
()¶ Operator to convert into uint16_t value.
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast battery voltage to bytes.
The resulting array is:
[vbat1, vbat2]
-
1.2. Sensor type declarations¶
These declarations are oriented to hold the information by sensors.
1.2.1. GNSS type¶
-
struct
GNSS_t
¶ GNSS type.
Public Functions
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast GPS information to bytes.
The resulting array is:
Where: altitude is in meters*10, altitude is float and longitude is float.[altitude1, altitude2, latitude1, latitude2, latitude3, latitude4, longitude1, longitude2, longitude3, longitude4, ]
-
1.2.3. BME280 type¶
-
struct
BME280_t
¶ BME280 type.
Public Functions
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the result in the bytes array. It could be used to cast sensor values to bytes.
The resulting array is:
[temperature1, temperature2, humidity1, humidity2, ]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
TEMP::temperature HUM::humidity PRESS::pressure
-
1.2.4. ADXL345 type¶
-
struct
ADXL345_t
¶ ADXL345 type.
Public Functions
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the acceleration in the byte array.
The resulting array is:
[accel1, accel2, accel3, accel4, accel5, accel6]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
ACCEL::accelerationvalues
-
1.2.5. L3G4200D type¶
-
struct
L3G4200D_t
¶ L3G4200D type.
Public Functions
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the gyroscope in the byte array.
The resulting array is:
[gyro1, gyro2, gyro3, gyro4, gyro5, gyro6]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
GYRO::gyroscopevalues
-
1.2.6. HMC5883L type¶
-
struct
HMC5883L_t
¶ HMC5883L type.
Public Functions
-
operator uint8_t*
()¶ Operator to convert into uint8_t array.
This operator save the magnetometer in the byte array.
The resulting array is:
[mag1, mag2, mag3, mag4, mag5, mag6]
-
operator String
()¶ Operator to convert into String type.
This operator returns a string type. Could be used to print data for debugging purposes.
The resulting string is:
MAG::magnetometervalues
-
2. Class declaration¶
The main class is SensorsTlera
, which is explored
as follows:
-
class
SensorsTlera
¶ Class for Tlera Corp sensors.
Public Functions
-
SensorsTlera
()¶ Constructor for Tlera Corp.
-
mcuid_t
getUID
()¶ Obtain UID from device.
- Return Value
this->reg_ID
: return the uid
-
void
initialize_board
()¶ Initialize onboard elements.
-
void
initialize_GNSS
()¶ Initialize GNSS sensor.
Initialize the pins for GNSS, establishes the constellation, and the antenna type.
-
void
initialize_BMA400
()¶ Initialize BMA400 sensor.
-
void
initialize_BME280
()¶ Initialize BME280 sensor.
-
void
initialize_ADXL345
(ADXL345 sensorADXL345)¶ Initialize ADXL345 sensor.
- Parameters
sensorADXL345
: object of ADXL345 sensor
-
void
initialize_L3G4200D
(L3G4200D sensorL3G4200D)¶ Initialize L3G4200D sensor.
- Parameters
sensorL3G4200D
: object of L3G4200D sensor
-
void
initialize_HMC5883L
(HMC5883L sensorHMC5883L)¶ Initialize HMC5883L sensor.
- Parameters
sensorHMC5883L
: object of HMC5883L sensor
-
void
callibrate_BMA400
()¶ Callibrate BMA400 sensor.
Reset sensor and self test, apply compensation parameters and initialize it.
-
void
callibrate_BME280
()¶ Callibrate BME280 sensor.
Reset sensor and initialize the sensor according to pre-defined values.
-
batt_t
readSensors_batmon
()¶ Obtain voltage values.
Obtain values from microcrontroller internal functions.
- Return Value
this->battery_info
: Returns structure with battery information.
-
batt_t
readSensors_batmon_average
()¶ Obtain average voltage values.
Apply average and saves to internal battery_info structure.
- Return Value
this->battery_info
: Returns structure with battery information.
-
BME280_t
readSensors_BME280
()¶ Read values from BME280 sensor.
Obtain value of temperature, humidity and pressure and save them to BME280_t structure.
- Return Value
this->reg_BME280
: Returns structure with BME280 values.
-
ADXL345_t
readSensors_ADXL345
(ADXL345 sensorADXL345)¶ Read values from ADXL345 sensor.
Obtain value of acceleration and save them to ADXL345_t structure.
- Parameters
sensorADXL345
: object of ADXL345 type
- Return Value
this->reg_ADXL345
: Returns structure with ADXL345 values.
-
L3G4200D_t
readSensors_L3G4200D
(L3G4200D sensorL3G4200D)¶ Read values from L3G4200D sensor.
Obtain value of gyroscope and save them to L3G4200D_t structure.
- Parameters
sensorL3G4200D
: object of L3G4200D type
- Return Value
this->reg_L3G4200D
: Returns structure with L3G4200D values.
-
HMC5883L_t
readSensors_HMC5883L
(HMC5883L sensorHMC5883L)¶ Read values from HMC5883L sensor.
Obtain value of magnetometer and save them to HMC5883L_t structure.
- Parameters
sensorHMC5883L
: object of HMC5883L type
- Return Value
this->reg_HMC5883L
: Returns structure with HMC5883L values.
-
GNSS_t
readSensors_GNSS
()¶ Read values from GNSS sensor.
Obtain value from GPS and print according if It has spatial values.
- Return Value
this->reg_GNSS
: Returns structure with GPS values.
-
bool
GNSS_isSpatial
()¶ Detects if GPS has spatial values.
-
void
scanI2CDevices
()¶ Scan I2C devices.
Method copied from BME280 library created by Kris Winer 06/16/2017 Copyright Tlera Corporation
-