Humidity and Temperature Sensor - Sensirion SHT1x driver

Dependents:   mDot_TTN_DHT11_Boston16_CAM

Fork of SHTx by Roy van Dam

Embed: (wiki syntax)

« Back to documentation index

I2C Class Reference

I2C Class Reference

Class: I2C Humidity and Temperature Sensor - SHT15 I2C Bit-bang master driver. More...

#include <i2c.hpp>

Public Member Functions

 I2C (PinName sda, PinName scl)
 Constructor: SHTx::I2C Create an I2C Master interface, connected to the specified pins.
void setFrequency (uint32_t hz)
 Function: setFrequency Set the frequency of the SHTx::I2C interface.
void start (void)
 Function: start Issue start condition on the SHTx::I2C bus.
void stop (void)
 Function: stop Issue stop condition on the SHTx::I2C bus.
bool wait (void)
 Function: wait Wait for SHT15 to complete measurement.
void reset (void)
 Function: reset If communication with the device is lost the command will reset the serial interface.
bool write (uint8_t data)
 Function: write Write single byte out on the SHTx::I2C bus.
uint8_t read (bool ack)
 Function: write Read single byte form the I2C bus.

Detailed Description

Class: I2C Humidity and Temperature Sensor - SHT15 I2C Bit-bang master driver.

Definition at line 38 of file i2c.hpp.


Constructor & Destructor Documentation

I2C ( PinName  sda,
PinName  scl 
)

Constructor: SHTx::I2C Create an I2C Master interface, connected to the specified pins.

Bit-bang I2C driver to get around the lousy I2C implementation in the SHTx interface...

Variables: sda - I2C data line pin scl - I2C clock line pin

Definition at line 30 of file i2c.cpp.


Member Function Documentation

uint8_t read ( bool  ack )

Function: write Read single byte form the I2C bus.

Variables: ack - indicates if the byte is to be acknowledged returns - the read byte

Definition at line 101 of file i2c.cpp.

void reset ( void   )

Function: reset If communication with the device is lost the command will reset the serial interface.

Definition at line 75 of file i2c.cpp.

void setFrequency ( uint32_t  hz )

Function: setFrequency Set the frequency of the SHTx::I2C interface.

Variables: hz - The bus frequency in hertz

Definition at line 37 of file i2c.cpp.

void start ( void   )

Function: start Issue start condition on the SHTx::I2C bus.

Definition at line 42 of file i2c.cpp.

void stop ( void   )

Function: stop Issue stop condition on the SHTx::I2C bus.

Definition at line 54 of file i2c.cpp.

bool wait ( void   )

Function: wait Wait for SHT15 to complete measurement.

Max timeout 500ms.

Variables: returns - true if an ACK was received, false otherwise

Definition at line 62 of file i2c.cpp.

bool write ( uint8_t  data )

Function: write Write single byte out on the SHTx::I2C bus.

Variables: data - data to write out on bus returns - true if an ACK was received, false otherwise

Definition at line 85 of file i2c.cpp.