Adafruit MCP9808 Arduino Library
Public Member Functions | List of all members
Adafruit_MCP9808 Class Reference

Class that stores state and functions for interacting with MCP9808 Temp Sensor. More...

#include <Adafruit_MCP9808.h>

Inheritance diagram for Adafruit_MCP9808:

Public Member Functions

 Adafruit_MCP9808 ()
 Instantiates a new MCP9808 class.
 
bool begin ()
 Setups the HW with default address. More...
 
bool begin (TwoWire *theWire)
 Setups the HW. More...
 
bool begin (uint8_t addr)
 Setups the HW. More...
 
bool begin (uint8_t addr, TwoWire *theWire)
 Setups the HW. More...
 
bool init ()
 init function More...
 
float readTempC ()
 Reads the 16-bit temperature register and returns the Centigrade temperature as a float. More...
 
float readTempF ()
 Reads the 16-bit temperature register and returns the Fahrenheit temperature as a float. More...
 
uint8_t getResolution (void)
 Get Resolution Value. More...
 
void setResolution (uint8_t value)
 Set Resolution Value. More...
 
void shutdown_wake (boolean sw)
 Set Sensor to Shutdown-State or wake up (Conf_Register BIT8) More...
 
void shutdown ()
 Shutdown MCP9808.
 
void wake ()
 Wake up MCP9808.
 
void write16 (uint8_t reg, uint16_t val)
 Low level 16 bit write procedures. More...
 
uint16_t read16 (uint8_t reg)
 Low level 16 bit read procedure. More...
 
void write8 (uint8_t reg, uint8_t val)
 Low level 8 bit write procedure. More...
 
uint8_t read8 (uint8_t reg)
 Low level 8 bit read procedure. More...
 
bool getEvent (sensors_event_t *)
 Gets the pressure sensor and temperature values as sensor events. More...
 
void getSensor (sensor_t *)
 Gets the overall sensor_t data including the type, range and resulution. More...
 

Detailed Description

Class that stores state and functions for interacting with MCP9808 Temp Sensor.

Member Function Documentation

◆ begin() [1/4]

bool Adafruit_MCP9808::begin ( )

Setups the HW with default address.

Returns
True if initialization was successful, otherwise false.

◆ begin() [2/4]

bool Adafruit_MCP9808::begin ( TwoWire *  theWire)

Setups the HW.

Parameters
*theWire
Returns
True if initialization was successful, otherwise false.

◆ begin() [3/4]

bool Adafruit_MCP9808::begin ( uint8_t  addr)

Setups the HW.

Parameters
addr
Returns
True if initialization was successful, otherwise false.

◆ begin() [4/4]

bool Adafruit_MCP9808::begin ( uint8_t  addr,
TwoWire *  theWire 
)

Setups the HW.

Parameters
addr
*theWire
Returns
True if initialization was successful, otherwise false.

◆ init()

bool Adafruit_MCP9808::init ( )

init function

Returns
True if initialization was successful, otherwise false.

◆ readTempC()

float Adafruit_MCP9808::readTempC ( )

Reads the 16-bit temperature register and returns the Centigrade temperature as a float.

Returns
Temperature in Centigrade.

◆ readTempF()

float Adafruit_MCP9808::readTempF ( )

Reads the 16-bit temperature register and returns the Fahrenheit temperature as a float.

Returns
Temperature in Fahrenheit.

◆ getResolution()

uint8_t Adafruit_MCP9808::getResolution ( void  )

Get Resolution Value.

Returns
Resolution value

◆ setResolution()

void Adafruit_MCP9808::setResolution ( uint8_t  value)

Set Resolution Value.

Parameters
value

◆ shutdown_wake()

void Adafruit_MCP9808::shutdown_wake ( boolean  sw)

Set Sensor to Shutdown-State or wake up (Conf_Register BIT8)

Parameters
swtrue = shutdown / false = wakeup

◆ write16()

void Adafruit_MCP9808::write16 ( uint8_t  reg,
uint16_t  value 
)

Low level 16 bit write procedures.

Parameters
reg
value

◆ read16()

uint16_t Adafruit_MCP9808::read16 ( uint8_t  reg)

Low level 16 bit read procedure.

Parameters
reg
Returns
value

◆ write8()

void Adafruit_MCP9808::write8 ( uint8_t  reg,
uint8_t  value 
)

Low level 8 bit write procedure.

Parameters
reg
value

◆ read8()

uint8_t Adafruit_MCP9808::read8 ( uint8_t  reg)

Low level 8 bit read procedure.

Parameters
reg
Returns
value

◆ getEvent()

bool Adafruit_MCP9808::getEvent ( sensors_event_t *  temp)

Gets the pressure sensor and temperature values as sensor events.

Parameters
tempSensor event object that will be populated with temp data
Returns
True

◆ getSensor()

void Adafruit_MCP9808::getSensor ( sensor_t *  sensor)

Gets the overall sensor_t data including the type, range and resulution.

Parameters
sensorPointer to Adafruit_Sensor sensor_t object that will be filled with sensor type data

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