From 031bd34655e737ef4aab026a2bf990825800e80f Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Thu, 3 Jan 2019 21:29:22 +0100 Subject: [PATCH] Remove unused headers from previous test projects --- include/mgos_ccs811.h | 102 ----------------------------------------- include/mgos_htu21df.h | 80 -------------------------------- include/mgos_mcp9808.h | 76 ------------------------------ include/mgos_mpu9250.h | 92 ------------------------------------- include/mgos_sht31.h | 80 -------------------------------- include/mgos_si7021.h | 80 -------------------------------- 6 files changed, 510 deletions(-) delete mode 100644 include/mgos_ccs811.h delete mode 100644 include/mgos_htu21df.h delete mode 100644 include/mgos_mcp9808.h delete mode 100644 include/mgos_mpu9250.h delete mode 100644 include/mgos_sht31.h delete mode 100644 include/mgos_si7021.h diff --git a/include/mgos_ccs811.h b/include/mgos_ccs811.h deleted file mode 100644 index 092bf8a..0000000 --- a/include/mgos_ccs811.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "mgos.h" -#include "mgos_i2c.h" - -#define MGOS_CCS811_READ_DELAY (2) - -#ifdef __cplusplus -extern "C" { - #endif - -struct mgos_ccs811; -struct mgos_ccs811_stats { - double last_read_time; // value of mg_time() upon last call to _read() - uint32_t read; // calls to _read() - uint32_t read_success; // successful _read() - uint32_t read_success_cached; // calls to _read() which were cached - // Note: read_errors := read - read_success - read_success_cached - double read_success_usecs; // time spent in successful uncached _read() -}; - -// Drive modes -enum mgos_ccs811_drive_mode_t { - CCS811_DRIVE_MODE_IDLE = 0x00, - CCS811_DRIVE_MODE_1SEC = 0x01, - CCS811_DRIVE_MODE_10SEC = 0x02, - CCS811_DRIVE_MODE_60SEC = 0x03, - CCS811_DRIVE_MODE_250MS = 0x04, -}; - -/* - * Initialize a CCS811 on the I2C bus `i2c` at address specified in `i2caddr` - * parameter (default CCS811 is on address 0x5A). The sensor will be polled for - * validity, upon success a new `struct mgos_ccs811` is allocated and - * returned. If the device could not be found, NULL is returned. - */ -struct mgos_ccs811 *mgos_ccs811_create(struct mgos_i2c *i2c, uint8_t i2caddr); - -/* - * Destroy the data structure associated with a CCS811 device. The reference - * to the pointer of the `struct mgos_ccs811` has to be provided, and upon - * successful destruction, its associated memory will be freed and the pointer - * set to NULL. - */ -void mgos_ccs811_destroy(struct mgos_ccs811 **sensor); - -/* - * The sensor will be polled for its temperature and humidity data. If the poll - * has occured in the last `MGOS_CCS811_READ_DELAY` seconds, the cached data is - * used (so as not to repeatedly poll the bus upon subsequent calls). - */ -bool mgos_ccs811_read(struct mgos_ccs811 *sensor); - -/* - * Set the drive mode of the CCS811 sensor based on the `mode` argument - * Returns true on success, false otherwise. - */ -bool mgos_ccs811_setDriveMode(struct mgos_ccs811 *sensor, enum mgos_ccs811_drive_mode_t mode); - -/* - * Retrieve the current drive mode (which will be one of `enum mgos_ccs811_drive_mode_t` - * values into the byte pointed to by `mode`. - * Returns true on success, false otherwise. - */ -bool mgos_ccs811_getDriveMode(struct mgos_ccs811 *sensor, uint8_t *mode); - -/* - * - * Returns a value on success, NAN otherwise. - */ -float mgos_ccs811_get_eco2(struct mgos_ccs811 *sensor); - -/* - * - * Returns a value on success, NAN otherwise. - */ -float mgos_ccs811_get_tvoc(struct mgos_ccs811 *sensor); - -/* - * Initialization function for MGOS -- currently a noop. - */ -bool mgos_ccs811_i2c_init(void); - - #ifdef __cplusplus -} -#endif diff --git a/include/mgos_htu21df.h b/include/mgos_htu21df.h deleted file mode 100644 index ebde7f3..0000000 --- a/include/mgos_htu21df.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "mgos.h" -#include "mgos_i2c.h" - -#define MGOS_HTU21DF_READ_DELAY (2) - -#ifdef __cplusplus -extern "C" { - #endif - - 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); - - /* - * 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). - * - * 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); - - /* - * Initialization function for MGOS -- currently a noop. - */ - bool mgos_htu21df_i2c_init(void); - - #ifdef __cplusplus -} -#endif diff --git a/include/mgos_mcp9808.h b/include/mgos_mcp9808.h deleted file mode 100644 index decb8ed..0000000 --- a/include/mgos_mcp9808.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "mgos.h" -#include "mgos_i2c.h" - -#define MGOS_MCP9808_READ_DELAY (2) - -#ifdef __cplusplus -extern "C" { - #endif - - 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); - - /* - * 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). - * - * 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); - - /* - * Initialization function for MGOS -- currently a noop. - */ - bool mgos_mcp9808_i2c_init(void); - - #ifdef __cplusplus -} -#endif diff --git a/include/mgos_mpu9250.h b/include/mgos_mpu9250.h deleted file mode 100644 index e7971cb..0000000 --- a/include/mgos_mpu9250.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "mgos.h" -#include "mgos_i2c.h" - -#define MGOS_MPU9250_READ_DELAY (2) - -#ifdef __cplusplus -extern "C" { - #endif - -struct mgos_mpu9250; - -enum mgos_mpu9250_accelerometer_range { - RANGE_16G = 3, - RANGE_8G = 2, - RANGE_4G = 1, - RANGE_2G = 0 -}; - -enum mgos_mpu9250_gyroscope_range { - RANGE_GYRO_2000 = 3, - RANGE_GYRO_1000 = 2, - RANGE_GYRO_500 = 1, - RANGE_GYRO_250 = 0 -}; - -enum mgos_mpu9250_magnetometer_scale { - SCALE_14_BITS = 0, - SCALE_16_BITS = 1 -}; - -enum mgos_mpu9250_magnetometer_speed { - MAG_8_HZ = 0, - MAG_100_HZ = 1 -}; - - -/* - * Initialize a MPU9250 on the I2C bus `i2c` at address specified in `i2caddr` - * parameter (default MPU9250 is on address 0x68). The imu will be polled for - * validity, upon success a new `struct mgos_mpu9250` is allocated and - * returned. If the device could not be found, NULL is returned. - */ -struct mgos_mpu9250 *mgos_mpu9250_create(struct mgos_i2c *i2c, uint8_t i2caddr); - -/* - * Destroy the data structure associated with a MPU9250 device. The reference - * to the pointer of the `struct mgos_mpu9250` has to be provided, and upon - * successful destruction, its associated memory will be freed and the pointer - * set to NULL. - */ -void mgos_mpu9250_destroy(struct mgos_mpu9250 **imu); - -bool mgos_mpu9250_set_accelerometer_range(struct mgos_mpu9250 *imu, enum mgos_mpu9250_accelerometer_range range); -bool mgos_mpu9250_get_accelerometer_range(struct mgos_mpu9250 *imu, enum mgos_mpu9250_accelerometer_range *range); -bool mgos_mpu9250_get_accelerometer(struct mgos_mpu9250 *imu, float *x, float *y, float *z); - -bool mgos_mpu9250_set_gyroscope_range(struct mgos_mpu9250 *imu, enum mgos_mpu9250_gyroscope_range range); -bool mgos_mpu9250_get_gyroscope_range(struct mgos_mpu9250 *imu, enum mgos_mpu9250_gyroscope_range *range); -bool mgos_mpu9250_get_gyroscope(struct mgos_mpu9250 *imu, float *x, float *y, float *z); - -bool mgos_mpu9250_set_magnetometer_scale(struct mgos_mpu9250 *imu, enum mgos_mpu9250_magnetometer_scale scale); -bool mgos_mpu9250_get_magnetometer_scale(struct mgos_mpu9250 *imu, enum mgos_mpu9250_magnetometer_scale *scale); -bool mgos_mpu9250_set_magnetometer_speed(struct mgos_mpu9250 *imu, enum mgos_mpu9250_magnetometer_speed speed); -bool mgos_mpu9250_get_magnetometer_speed(struct mgos_mpu9250 *imu, enum mgos_mpu9250_magnetometer_speed *speed); -bool mgos_mpu9250_get_magnetometer(struct mgos_mpu9250 *imu, float *x, float *y, float *z); - -/* - * Initialization function for MGOS -- currently a noop. - */ -bool mgos_mpu9250_i2c_init(void); - - #ifdef __cplusplus -} -#endif diff --git a/include/mgos_sht31.h b/include/mgos_sht31.h deleted file mode 100644 index adc152c..0000000 --- a/include/mgos_sht31.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "mgos.h" -#include "mgos_i2c.h" - -#define MGOS_SHT31_READ_DELAY (2) - -#ifdef __cplusplus -extern "C" { - #endif - - 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); - - #ifdef __cplusplus -} -#endif diff --git a/include/mgos_si7021.h b/include/mgos_si7021.h deleted file mode 100644 index bf60608..0000000 --- a/include/mgos_si7021.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "mgos.h" -#include "mgos_i2c.h" - -#define MGOS_SI7021_READ_DELAY (2) - -#ifdef __cplusplus -extern "C" { - #endif - - 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); - - #ifdef __cplusplus -} -#endif