upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Go to the source code of this file.
Data Structures | |
struct | _sht1x_context |
Functions | |
sht1x_context | sht1x_init (unsigned int clk_pin, unsigned int data_pin) |
void | sht1x_close (sht1x_context dev) |
void | sht1x_reset (const sht1x_context dev) |
upm_result_t | sht1x_update (const sht1x_context dev) |
float | sht1x_get_temperature (const sht1x_context dev) |
float | sht1x_get_humidity (const sht1x_context dev) |
upm_result_t | sht1x_read_status (const sht1x_context dev, uint8_t *status) |
upm_result_t | sht1x_write_status (const sht1x_context dev, uint8_t status) |
void | sht1x_set_volts (const sht1x_context dev, SHT1X_VOLTS_T volts) |
upm_result_t | sht1x_send_command (const sht1x_context dev, SHT1X_CMD_T cmd) |
upm_result_t | sht1x_wait_for_response (const sht1x_context dev) |
void | sht1x_start_xmit (const sht1x_context dev) |
void | sht1x_read_8bits (const sht1x_context dev, uint8_t *value) |
upm_result_t | sht1x_write_8bits (const sht1x_context dev, uint8_t byte) |
Typedefs | |
typedef struct _sht1x_context * | sht1x_context |
sht1x_context sht1x_init | ( | unsigned int | clk_pin, |
unsigned int | data_pin | ||
) |
SHT1X Initializer
clk_pin | Specify the GPIO pin to use for the clock. |
data_pin | Specify the GPIO pin to use for data. |
void sht1x_close | ( | sht1x_context | dev | ) |
SHT1X sensor close function
void sht1x_reset | ( | const sht1x_context | dev | ) |
Perform a soft reset of the device.
dev | sensor context |
upm_result_t sht1x_update | ( | const sht1x_context | dev | ) |
Query the device and store the latest values. You must call this function before querying the temperature or the humidity.
dev | sensor context |
float sht1x_get_temperature | ( | const sht1x_context | dev | ) |
Query the temperature in degrees Celsius. sht1x_update() must have been called prior to calling this function.
dev | sensor context |
float sht1x_get_humidity | ( | const sht1x_context | dev | ) |
Query the relative humidity. sht1x_update() must have been called prior to calling this function.
dev | sensor context |
upm_result_t sht1x_read_status | ( | const sht1x_context | dev, |
uint8_t * | status | ||
) |
Read the status register.
dev | sensor context |
status | The pointer to a uint8_t the status register will be stored in. |
upm_result_t sht1x_write_status | ( | const sht1x_context | dev, |
uint8_t | status | ||
) |
Write a value to the status register.
dev | sensor context |
status | The uint8_t to write to the register. |
void sht1x_set_volts | ( | const sht1x_context | dev, |
SHT1X_VOLTS_T | volts | ||
) |
The Vdd voltage the sensor is being driven at can affect the temperature measurements. This function allows you to specify a voltage as close as you are using to power the sensor, so that the appropriate compensation can be made. By default, the coefficients are set for 5v operation.
dev | sensor context |
volts | One of the SHT1X_VOLTS_T values. |
upm_result_t sht1x_send_command | ( | const sht1x_context | dev, |
SHT1X_CMD_T | cmd | ||
) |
Send a command to the device. This is a low level command that should not be used directly unless you know exactly what you are doing.
dev | sensor context |
cmd | One of the SHT1X_CMD_T values. |
upm_result_t sht1x_wait_for_response | ( | const sht1x_context | dev | ) |
Wait for the appropriate response when starting a temperature or humidity measurement. This is a low level command that should not be used directly unless you know exactly what you are doing.
dev | sensor context |
void sht1x_start_xmit | ( | const sht1x_context | dev | ) |
Issue the start transmission sequence. This is a low level command that should not be used directly unless you know exactly what you are doing.
dev | sensor context |
void sht1x_read_8bits | ( | const sht1x_context | dev, |
uint8_t * | value | ||
) |
Read 8 bits (a byte) from the device. This is a low level command that should not be used directly unless you know exactly what you are doing.
dev | sensor context |
value | Pointer to a uint8_t that will hold the received byte. |
upm_result_t sht1x_write_8bits | ( | const sht1x_context | dev, |
uint8_t | byte | ||
) |
Write 8 bits (a byte) to the device. This is a low level command that should not be used directly unless you know exactly what you are doing.
dev | sensor context |
value | A uint8_t that will be sent to the device. |
typedef struct _sht1x_context * sht1x_context |
Device context