Reformat with bcpp
Used commandline: bcpp -i 2 -yq -ya -s -bcl -tbcl $i
This commit is contained in:
@ -23,58 +23,58 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct mgos_htu21df;
|
||||
struct mgos_htu21df;
|
||||
|
||||
/*
|
||||
* Initialize a HTU21DF on the I2C bus `i2c` at address specified in `i2caddr`
|
||||
* parameter (default HTU21DF is on address 0x40). The sensor will be polled for
|
||||
* validity, upon success a new `struct mgos_htu21df` is allocated and
|
||||
* returned. If the device could not be found, NULL is returned.
|
||||
*/
|
||||
struct mgos_htu21df *mgos_htu21df_create(struct mgos_i2c *i2c, uint8_t i2caddr);
|
||||
/*
|
||||
* Initialize a HTU21DF on the I2C bus `i2c` at address specified in `i2caddr`
|
||||
* parameter (default HTU21DF is on address 0x40). The sensor will be polled for
|
||||
* validity, upon success a new `struct mgos_htu21df` is allocated and
|
||||
* returned. If the device could not be found, NULL is returned.
|
||||
*/
|
||||
struct mgos_htu21df *mgos_htu21df_create(struct mgos_i2c *i2c, uint8_t i2caddr);
|
||||
|
||||
/*
|
||||
* Destroy the data structure associated with a HTU21DF device. The reference
|
||||
* to the pointer of the `struct mgos_htu21df` has to be provided, and upon
|
||||
* successful destruction, its associated memory will be freed and the pointer
|
||||
* set to NULL.
|
||||
*/
|
||||
void mgos_htu21df_destroy(struct mgos_htu21df **sensor);
|
||||
/*
|
||||
* Destroy the data structure associated with a HTU21DF device. The reference
|
||||
* to the pointer of the `struct mgos_htu21df` has to be provided, and upon
|
||||
* successful destruction, its associated memory will be freed and the pointer
|
||||
* set to NULL.
|
||||
*/
|
||||
void mgos_htu21df_destroy(struct mgos_htu21df **sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_HTU21DF_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*/
|
||||
bool mgos_htu21df_read(struct mgos_htu21df *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_HTU21DF_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*/
|
||||
bool mgos_htu21df_read(struct mgos_htu21df *sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_HTU21DF_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the temperature of the sensor in Celsius, or NAN if no
|
||||
* data was found.
|
||||
*/
|
||||
float mgos_htu21df_getTemperature(struct mgos_htu21df *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_HTU21DF_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the temperature of the sensor in Celsius, or NAN if no
|
||||
* data was found.
|
||||
*/
|
||||
float mgos_htu21df_getTemperature(struct mgos_htu21df *sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_HTU21DF_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the humidity of the sensor in percent relative humidity,
|
||||
* or NAN if no data was found.
|
||||
*/
|
||||
float mgos_htu21df_getHumidity(struct mgos_htu21df *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_HTU21DF_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the humidity of the sensor in percent relative humidity,
|
||||
* or NAN if no data was found.
|
||||
*/
|
||||
float mgos_htu21df_getHumidity(struct mgos_htu21df *sensor);
|
||||
|
||||
/*
|
||||
* Initialization function for MGOS -- currently a noop.
|
||||
*/
|
||||
bool mgos_htu21df_i2c_init(void);
|
||||
/*
|
||||
* Initialization function for MGOS -- currently a noop.
|
||||
*/
|
||||
bool mgos_htu21df_i2c_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -23,54 +23,54 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct mgos_mcp9808;
|
||||
struct mgos_mcp9808;
|
||||
|
||||
/*
|
||||
* Initialize a MCP9808 on the I2C bus `i2c` at address specified in `i2caddr`
|
||||
* parameter (default MCP9808 is on address 0x18). The sensor will be polled for
|
||||
* validity, upon success a new `struct mgos_mcp9808` is allocated and
|
||||
* returned. If the device could not be found, NULL is returned.
|
||||
*/
|
||||
struct mgos_mcp9808 *mgos_mcp9808_create(struct mgos_i2c *i2c, uint8_t i2caddr);
|
||||
/*
|
||||
* Initialize a MCP9808 on the I2C bus `i2c` at address specified in `i2caddr`
|
||||
* parameter (default MCP9808 is on address 0x18). The sensor will be polled for
|
||||
* validity, upon success a new `struct mgos_mcp9808` is allocated and
|
||||
* returned. If the device could not be found, NULL is returned.
|
||||
*/
|
||||
struct mgos_mcp9808 *mgos_mcp9808_create(struct mgos_i2c *i2c, uint8_t i2caddr);
|
||||
|
||||
/*
|
||||
* Destroy the data structure associated with a MCP9808 device. The reference
|
||||
* to the pointer of the `struct mgos_mcp9808` has to be provided, and upon
|
||||
* successful destruction, its associated memory will be freed and the pointer
|
||||
* set to NULL.
|
||||
*/
|
||||
void mgos_mcp9808_destroy(struct mgos_mcp9808 **sensor);
|
||||
/*
|
||||
* Destroy the data structure associated with a MCP9808 device. The reference
|
||||
* to the pointer of the `struct mgos_mcp9808` has to be provided, and upon
|
||||
* successful destruction, its associated memory will be freed and the pointer
|
||||
* set to NULL.
|
||||
*/
|
||||
void mgos_mcp9808_destroy(struct mgos_mcp9808 **sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_MCP9808_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*/
|
||||
bool mgos_mcp9808_read(struct mgos_mcp9808 *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_MCP9808_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*/
|
||||
bool mgos_mcp9808_read(struct mgos_mcp9808 *sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_MCP9808_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the temperature of the sensor in Celsius, or NAN if no
|
||||
* data was found.
|
||||
*/
|
||||
float mgos_mcp9808_getTemperature(struct mgos_mcp9808 *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_MCP9808_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the temperature of the sensor in Celsius, or NAN if no
|
||||
* data was found.
|
||||
*/
|
||||
float mgos_mcp9808_getTemperature(struct mgos_mcp9808 *sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be enabled (true) or disabled and put into deep sleep (false)
|
||||
* based on the `enable` argument.
|
||||
*/
|
||||
void mgos_mcp9808_enable(struct mgos_mcp9808 *sensor, bool enable);
|
||||
/*
|
||||
* The sensor will be enabled (true) or disabled and put into deep sleep (false)
|
||||
* based on the `enable` argument.
|
||||
*/
|
||||
void mgos_mcp9808_enable(struct mgos_mcp9808 *sensor, bool enable);
|
||||
|
||||
/*
|
||||
* Initialization function for MGOS -- currently a noop.
|
||||
*/
|
||||
bool mgos_mcp9808_i2c_init(void);
|
||||
/*
|
||||
* Initialization function for MGOS -- currently a noop.
|
||||
*/
|
||||
bool mgos_mcp9808_i2c_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -19,13 +19,13 @@
|
||||
#ifndef __MGOS_MOCK_H
|
||||
#define __MGOS_MOCK_H
|
||||
|
||||
|
||||
#include "mgos.h"
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
// mgos_log
|
||||
enum cs_log_level {
|
||||
enum cs_log_level
|
||||
{
|
||||
LL_NONE = -1,
|
||||
LL_ERROR = 0,
|
||||
LL_WARN = 1,
|
||||
@ -39,15 +39,14 @@ enum cs_log_level {
|
||||
|
||||
int log_print_prefix(enum cs_log_level l, const char *func, const char *file);
|
||||
|
||||
#define LOG(l, x) \
|
||||
do { \
|
||||
#define LOG(l, x) \
|
||||
do \
|
||||
{ \
|
||||
if (log_print_prefix(l, __func__, __FILE__)) printf x; \
|
||||
printf("\r\n"); \
|
||||
} while (0)
|
||||
|
||||
|
||||
double mg_time();
|
||||
|
||||
void mgos_usleep(uint32_t usecs);
|
||||
|
||||
#endif // __MGOS_MOCK_H
|
||||
#endif // __MGOS_MOCK_H
|
||||
|
@ -23,58 +23,58 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct mgos_sht31;
|
||||
struct mgos_sht31;
|
||||
|
||||
/*
|
||||
* Initialize a SHT31 on the I2C bus `i2c` at address specified in `i2caddr`
|
||||
* parameter (default SHT31 is on address 0x44). The sensor will be polled for
|
||||
* validity, upon success a new `struct mgos_sht31` is allocated and
|
||||
* returned. If the device could not be found, NULL is returned.
|
||||
*/
|
||||
struct mgos_sht31 *mgos_sht31_create(struct mgos_i2c *i2c, uint8_t i2caddr);
|
||||
/*
|
||||
* Initialize a SHT31 on the I2C bus `i2c` at address specified in `i2caddr`
|
||||
* parameter (default SHT31 is on address 0x44). The sensor will be polled for
|
||||
* validity, upon success a new `struct mgos_sht31` is allocated and
|
||||
* returned. If the device could not be found, NULL is returned.
|
||||
*/
|
||||
struct mgos_sht31 *mgos_sht31_create(struct mgos_i2c *i2c, uint8_t i2caddr);
|
||||
|
||||
/*
|
||||
* Destroy the data structure associated with a SHT31 device. The reference
|
||||
* to the pointer of the `struct mgos_sht31` has to be provided, and upon
|
||||
* successful destruction, its associated memory will be freed and the pointer
|
||||
* set to NULL.
|
||||
*/
|
||||
void mgos_sht31_destroy(struct mgos_sht31 **sensor);
|
||||
/*
|
||||
* Destroy the data structure associated with a SHT31 device. The reference
|
||||
* to the pointer of the `struct mgos_sht31` has to be provided, and upon
|
||||
* successful destruction, its associated memory will be freed and the pointer
|
||||
* set to NULL.
|
||||
*/
|
||||
void mgos_sht31_destroy(struct mgos_sht31 **sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SHT31_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*/
|
||||
bool mgos_sht31_read(struct mgos_sht31 *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SHT31_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*/
|
||||
bool mgos_sht31_read(struct mgos_sht31 *sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SHT31_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the temperature of the sensor in Celsius, or NAN if no
|
||||
* data was found.
|
||||
*/
|
||||
float mgos_sht31_getTemperature(struct mgos_sht31 *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SHT31_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the temperature of the sensor in Celsius, or NAN if no
|
||||
* data was found.
|
||||
*/
|
||||
float mgos_sht31_getTemperature(struct mgos_sht31 *sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SHT31_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the humidity of the sensor in percent relative humidity,
|
||||
* or NAN if no data was found.
|
||||
*/
|
||||
float mgos_sht31_getHumidity(struct mgos_sht31 *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SHT31_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the humidity of the sensor in percent relative humidity,
|
||||
* or NAN if no data was found.
|
||||
*/
|
||||
float mgos_sht31_getHumidity(struct mgos_sht31 *sensor);
|
||||
|
||||
/*
|
||||
* Initialization function for MGOS -- currently a noop.
|
||||
*/
|
||||
bool mgos_sht31_i2c_init(void);
|
||||
/*
|
||||
* Initialization function for MGOS -- currently a noop.
|
||||
*/
|
||||
bool mgos_sht31_i2c_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -23,58 +23,58 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct mgos_si7021;
|
||||
struct mgos_si7021;
|
||||
|
||||
/*
|
||||
* Initialize a Si7021 on the I2C bus `i2c` at address specified in `i2caddr`
|
||||
* parameter (default Si7021 is on address 0x40). The sensor will be polled for
|
||||
* validity, upon success a new `struct mgos_si7021` is allocated and
|
||||
* returned. If the device could not be found, NULL is returned.
|
||||
*/
|
||||
struct mgos_si7021 *mgos_si7021_create(struct mgos_i2c *i2c, uint8_t i2caddr);
|
||||
/*
|
||||
* Initialize a Si7021 on the I2C bus `i2c` at address specified in `i2caddr`
|
||||
* parameter (default Si7021 is on address 0x40). The sensor will be polled for
|
||||
* validity, upon success a new `struct mgos_si7021` is allocated and
|
||||
* returned. If the device could not be found, NULL is returned.
|
||||
*/
|
||||
struct mgos_si7021 *mgos_si7021_create(struct mgos_i2c *i2c, uint8_t i2caddr);
|
||||
|
||||
/*
|
||||
* Destroy the data structure associated with a Si7021 device. The reference
|
||||
* to the pointer of the `struct mgos_si7021` has to be provided, and upon
|
||||
* successful destruction, its associated memory will be freed and the pointer
|
||||
* set to NULL.
|
||||
*/
|
||||
void mgos_si7021_destroy(struct mgos_si7021 **sensor);
|
||||
/*
|
||||
* Destroy the data structure associated with a Si7021 device. The reference
|
||||
* to the pointer of the `struct mgos_si7021` has to be provided, and upon
|
||||
* successful destruction, its associated memory will be freed and the pointer
|
||||
* set to NULL.
|
||||
*/
|
||||
void mgos_si7021_destroy(struct mgos_si7021 **sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SI7021_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*/
|
||||
bool mgos_si7021_read(struct mgos_si7021 *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SI7021_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*/
|
||||
bool mgos_si7021_read(struct mgos_si7021 *sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SI7021_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the temperature of the sensor in Celsius, or NAN if no
|
||||
* data was found.
|
||||
*/
|
||||
float mgos_si7021_getTemperature(struct mgos_si7021 *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SI7021_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the temperature of the sensor in Celsius, or NAN if no
|
||||
* data was found.
|
||||
*/
|
||||
float mgos_si7021_getTemperature(struct mgos_si7021 *sensor);
|
||||
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SI7021_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the humidity of the sensor in percent relative humidity,
|
||||
* or NAN if no data was found.
|
||||
*/
|
||||
float mgos_si7021_getHumidity(struct mgos_si7021 *sensor);
|
||||
/*
|
||||
* The sensor will be polled for its temperature and humidity data. If the poll
|
||||
* has occured in the last `MGOS_SI7021_READ_DELAY` seconds, the cached data is
|
||||
* used (so as not to repeatedly poll the bus upon subsequent calls).
|
||||
*
|
||||
* The return value is the humidity of the sensor in percent relative humidity,
|
||||
* or NAN if no data was found.
|
||||
*/
|
||||
float mgos_si7021_getHumidity(struct mgos_si7021 *sensor);
|
||||
|
||||
/*
|
||||
* Initialization function for MGOS -- currently a noop.
|
||||
*/
|
||||
bool mgos_si7021_i2c_init(void);
|
||||
/*
|
||||
* Initialization function for MGOS -- currently a noop.
|
||||
*/
|
||||
bool mgos_si7021_i2c_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user