Adafruit AM2320 Arduino Library
Classes | Public Member Functions | List of all members
Adafruit_AM2320 Class Reference

Class that stores state and functions for interacting with AM2320 Temperature & Humidity Unified Sensor. More...

#include <Adafruit_AM2320.h>

Classes

class  Humidity
 humidity sensor class More...
 
class  Temperature
 temperature sensor class More...
 

Public Member Functions

 Adafruit_AM2320 (TwoWire *theI2C=&Wire, int32_t tempSensorId=-1, int32_t humiditySensorId=-1)
 Instantiates a new AM2320 class. More...
 
bool begin ()
 Setups the hardware. More...
 
float readTemperature ()
 read the temperature from the device More...
 
float readHumidity ()
 read the humidity from the device More...
 
uint32_t readRegister32 (uint8_t reg)
 read 4 bytes from a hardware register More...
 
uint16_t crc16 (uint8_t *buffer, uint8_t nbytes)
 perfor a CRC check to verify data More...
 
Temperature temperature ()
 get the temperature sensor object belonging to this class More...
 
Humidity humidity ()
 get the humidity sensor object belonging to this class More...
 

Detailed Description

Class that stores state and functions for interacting with AM2320 Temperature & Humidity Unified Sensor.

Constructor & Destructor Documentation

◆ Adafruit_AM2320()

Adafruit_AM2320::Adafruit_AM2320 ( TwoWire *  theI2C = &Wire,
int32_t  tempSensorId = -1,
int32_t  humiditySensorId = -1 
)

Instantiates a new AM2320 class.

Parameters
theI2COptional pointer to a TwoWire object that should be used for I2C communication. Defaults to &Wire.
tempSensorIdthe id that should be used for the temperature sensor. Defaults to -1
humiditySensorIdthe id that should be used for the humidity sensor. Defaults to -1

Member Function Documentation

◆ begin()

bool Adafruit_AM2320::begin ( )

Setups the hardware.

Returns
true

◆ readTemperature()

float Adafruit_AM2320::readTemperature ( )

read the temperature from the device

Returns
the temperature reading as a floating point value

◆ readHumidity()

float Adafruit_AM2320::readHumidity ( )

read the humidity from the device

Returns
the humidity reading as a floating point value

◆ readRegister32()

uint32_t Adafruit_AM2320::readRegister32 ( uint8_t  reg)

read 4 bytes from a hardware register

Parameters
regthe register to read
Returns
the read value as a 4 byte unsigned integer

◆ crc16()

uint16_t Adafruit_AM2320::crc16 ( uint8_t *  buffer,
uint8_t  nbytes 
)

perfor a CRC check to verify data

Parameters
bufferthe pointer to the data to check
nbytesthe number of bytes to calculate the CRC over
Returns
the calculated CRC

◆ temperature()

Temperature Adafruit_AM2320::temperature ( )
inline

get the temperature sensor object belonging to this class

Returns
the temperature sensor object

◆ humidity()

Humidity Adafruit_AM2320::humidity ( )
inline

get the humidity sensor object belonging to this class

Returns
the humidity sensor object

The documentation for this class was generated from the following files: