upm
0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
|
API for the AM2315 Temperature & Humidity Sensor. More...
AM2315 by Measurement Specialties (http://www.aosong.com/asp_bin/Products/en/AM2315.pdf) is a digital humidity sensor with temperature output. RH reports between 0 and 100%, and the temperature range is -40 to +125 degC. The sampling period of this sensor is 2 seconds. Reads occurring more often than that return cached data.
Public Member Functions | |
AM2315 (int bus, int devAddr=AM2315_I2C_ADDRESS) | |
~AM2315 () | |
float | getHumidity (void) |
float | getTemperature (void) |
float | getTemperatureF (void) |
int | testSensor (void) |
int | i2cWriteReg_32 (int reg, uint32_t ival) |
int | i2cWriteReg_16 (int reg, uint16_t ival) |
int | i2cWriteReg_8 (int reg, uint8_t ival) |
uint32_t | i2cReadReg_32 (int reg) |
uint16_t | i2cReadReg_16 (int reg) |
uint8_t | i2cReadReg_8 (int reg) |
AM2315 | ( | int | bus, |
int | devAddr = AM2315_I2C_ADDRESS |
||
) |
float getHumidity | ( | void | ) |
Gets the current measured humidity [RH]
Data is updated every 2 seconds - accesses occurring more often than that return cached data
float getTemperature | ( | void | ) |
Gets the humidity cell temperature [degC]
Data is updated every 2 seconds - accesses occurring more often than that return cached data
float getTemperatureF | ( | void | ) |
Gets the humidity cell temperature [degF]
Data is updated every 2 seconds - accesses occurring more often than that return cached data
int testSensor | ( | void | ) |
Function intended to test the device and verify it is operating correctly.
int i2cWriteReg_32 | ( | int | reg, |
uint32_t | ival | ||
) |
Writes a four-byte (32b) register
Note: these access routines are not the normal accesses to an I2C device. AM2315 contains a microcontroller that manages the actual readings. These handlers then make requests over I2C using a protocol defined by AM2315.
reg | Address of the register |
ival | 32b value |
int i2cWriteReg_16 | ( | int | reg, |
uint16_t | ival | ||
) |
Writes a two-byte (16b) register
reg | Address of the register |
ival | 16b value |
int i2cWriteReg_8 | ( | int | reg, |
uint8_t | ival | ||
) |
Writes a one-byte (8b) register
reg | Address of the register |
ival | 8b value |
uint32_t i2cReadReg_32 | ( | int | reg | ) |
Reads a four-byte register
reg | Address of the register |
uint16_t i2cReadReg_16 | ( | int | reg | ) |
Reads a two-byte register
reg | Address of the register |
uint8_t i2cReadReg_8 | ( | int | reg | ) |
Reads a one-byte register
reg | Address of the register |