From 38500aa8d4824106616496c9449e854e3a090830 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Mon, 2 Apr 2018 22:05:53 +0200 Subject: [PATCH] Add public header documentation. --- include/mgos_sht31.h | 32 +++++++++++++++++++++++++------- include/mgos_si7021.h | 26 ++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/include/mgos_sht31.h b/include/mgos_sht31.h index 14263ea..fe73cf5 100644 --- a/include/mgos_sht31.h +++ b/include/mgos_sht31.h @@ -11,33 +11,51 @@ extern "C" { 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); -/* - * +/* + * 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). * + * 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); /* - * + * Initialization function for MGOS -- currently a noop. */ bool mgos_sht31_i2c_init(void); diff --git a/include/mgos_si7021.h b/include/mgos_si7021.h index 425b57e..ea8ec39 100644 --- a/include/mgos_si7021.h +++ b/include/mgos_si7021.h @@ -12,32 +12,50 @@ extern "C" { 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); /* - * + * 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). * + * 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); /* - * + * Initialization function for MGOS -- currently a noop. */ bool mgos_si7021_i2c_init(void);