Kenji Arai / HDC1000

Dependents:   AmbientExampleLPC1768 HumidifierController_LPC824 TYBLE16_mbedlized_Thermometer

Embed: (wiki syntax)

« Back to documentation index

HDC1000 Class Reference

HDC1000 Class Reference

Interface for Humidity / Temperature Sensor, HDC1000. More...

#include <HDC1000.h>

Public Member Functions

 HDC1000 (PinName p_sda, PinName p_scl)
 Configure data pin (with other devices on I2C line)
 HDC1000 (PinName p_sda, PinName p_scl, uint8_t addr)
 Configure data pin (with other devices on I2C line)
 HDC1000 (I2C &p_i2c)
 Configure data pin (with other devices on I2C line)
void get (void)
 Start convertion & data save.
float temperature (void)
 Read temperature data.
float humidity (void)
 Read humidity data.
void config (void)
 HDC1000 Configuration.
uint16_t read_config (void)
 Read Configuration.
uint16_t set_config (uint16_t cfg)
 Set config register.
void frequency (int hz)
 Set I2C clock frequency.
uint8_t who_am_i (void)
 check Device ID number
uint16_t read_M_ID (void)
 Read Manufacturer ID.
uint16_t read_D_ID (void)
 Read Device ID.

Detailed Description

Interface for Humidity / Temperature Sensor, HDC1000.

 #include "mbed.h"
 #include "HDC1000.h"

 // I2C Communication
  HDC1000      hmtp(dp5,dp27);    // HDC1000 SDA, SCL (Akizuki module)
 // If you connected I2C line not only this device but also other devices,
 //     you need to declare following method.
  I2C          i2c(dp5,dp27);     // SDA, SCL
  HDC1000      hmtp(i2c);         // HDC1000 SDA, SCL (Akizuki module)

 int main() {;
   while(true){
      hmtp.get();    // Triger conversion
      printf("Temp: %+4.1fC, Humid: %4.1f%%\r\n", hmtp.temperature(), hmtp.humidity());
      wait(1.0);
   }
 }

Definition at line 77 of file HDC1000.h.


Constructor & Destructor Documentation

HDC1000 ( PinName  p_sda,
PinName  p_scl 
)

Configure data pin (with other devices on I2C line)

Parameters:
dataSDA and SCL pins

Definition at line 15 of file HDC1000.cpp.

HDC1000 ( PinName  p_sda,
PinName  p_scl,
uint8_t  addr 
)

Configure data pin (with other devices on I2C line)

Parameters:
dataSDA and SCL pins
deviceaddress

Definition at line 22 of file HDC1000.cpp.

HDC1000 ( I2C &  p_i2c )

Configure data pin (with other devices on I2C line)

Parameters:
I2Cprevious definition

Definition at line 29 of file HDC1000.cpp.


Member Function Documentation

void config ( void   )

HDC1000 Configuration.

Parameters:
none
Returns:
none
void frequency ( int  hz )

Set I2C clock frequency.

Parameters:
freq.
Returns:
none

Definition at line 112 of file HDC1000.cpp.

void get ( void   )

Start convertion & data save.

Parameters:
none
Returns:
none

Definition at line 42 of file HDC1000.cpp.

float humidity ( void   )

Read humidity data.

Parameters:
none
Returns:
humidity

Definition at line 60 of file HDC1000.cpp.

uint16_t read_config ( void   )

Read Configuration.

Parameters:
none
Returns:
config. data

Definition at line 103 of file HDC1000.cpp.

uint16_t read_D_ID ( void   )

Read Device ID.

Parameters:
none
Returns:
ID

Definition at line 79 of file HDC1000.cpp.

uint16_t read_M_ID ( void   )

Read Manufacturer ID.

Parameters:
none
Returns:
ID

Definition at line 74 of file HDC1000.cpp.

uint16_t set_config ( uint16_t  cfg )

Set config register.

Parameters:
configparameter
Returns:
config read data

Definition at line 94 of file HDC1000.cpp.

float temperature ( void   )

Read temperature data.

Parameters:
none
Returns:
temperature

Definition at line 54 of file HDC1000.cpp.

uint8_t who_am_i ( void   )

check Device ID number

Parameters:
none
Returns:
HDC1000 = 1, others 0

Definition at line 84 of file HDC1000.cpp.