Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mongoose-os-libs/si7005
Si7005 Temperature and Humidity Sensor Driver for Mongoose OS
https://github.com/mongoose-os-libs/si7005
Last synced: about 2 months ago
JSON representation
Si7005 Temperature and Humidity Sensor Driver for Mongoose OS
- Host: GitHub
- URL: https://github.com/mongoose-os-libs/si7005
- Owner: mongoose-os-libs
- License: other
- Created: 2018-06-08T07:59:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-15T00:18:36.000Z (about 3 years ago)
- Last Synced: 2024-07-31T21:52:50.367Z (5 months ago)
- Language: C
- Size: 4.88 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mongoose-os - si7005 - Si7005 Temperature and Humidity Sensor Driver for Mongoose OS (Awesome Mongoose OS [![Awesome](https://awesome.re/badge.svg)](https://awesome.re) / Official Libraries)
README
# Si7005 Sensor Driver for Mongoose OS
## Overview
[Si7005](https://eu.mouser.com/new/Silicon-Laboratories/silabs-si7005/) is a temperature and relative humidity sensor by Silicon Labs.
This library provides a driver for this device.
## API documentation
See `include/si7005.h`.
## Example
```c
#include "mgos.h"#include "si7005.h"
static void temp_timer_cb(void *arg) {
float temp = si7005_read_temp();
float rh = si7005_read_rh();
LOG(LL_INFO, ("T %.2f RH %.2f", temp, rh));
(void) arg;
}enum mgos_app_init_result mgos_app_init(void) {
if (si7005_probe()) {
LOG(LL_INFO, ("Si7005 sensor found"));
mgos_set_timer(1000, MGOS_TIMER_REPEAT, temp_timer_cb, NULL);
} else {
LOG(LL_WARN, ("Failed to init temp sensor"));
}
return MGOS_APP_INIT_SUCCESS;
}
```_Note:_ You need to make sure that I2C is enabled. This can be achieved by adding
```yaml
config_schema:
- ["i2c.enable", true]
```
to mos.yml. You may need to adjust SDA and SCL pins as well.
See [I2C](https://github.com/mongoose-os-libs/i2c) library for details.