Include first driver: SHT31

Make I2C reads blocking w/ timeout
Add SHT31 driver, roughly :)
Fix mg_time() to return a double.
This commit is contained in:
Pim van Pelt
2018-04-02 17:29:13 +02:00
parent cef7c5107d
commit b1d92a32a8
9 changed files with 396 additions and 35 deletions

View File

@ -12,6 +12,15 @@
#pragma once
#include "mgos.h"
#include <stdio.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <string.h>
/* Each platform defines its own I2C connection parameters. */
struct mgos_i2c;
@ -113,5 +122,6 @@ void mgos_i2c_close(struct mgos_i2c *conn);
struct mgos_i2c *mgos_i2c_get_global(void);
// User contributed!
int get_i2c_register(struct mgos_i2c *i2c, uint8_t addr, uint8_t reg, uint8_t *val);
bool mgos_i2c_open(int busnr);