![]() |
SparkFun GM-X02B Arduino Library
v1.0.1
An Arduino library for the SparkFun Qwiic MEMS gas sensor breakouts built on the Winsen GM-x02B sensor family
|
Header file for the SparkFun Winsen GM-X02B MEMS Gas Sensor Driver. More...
#include <stddef.h>#include <stdint.h>#include <sfTk/sfTkII2C.h>#include <sfTk/sfToolkit.h>Go to the source code of this file.
Classes | |
| struct | sfe_gmx02b_part_t |
| Per-part parameters for one GM-x02B variant and its board. More... | |
| class | sfDevGMX02B |
| Platform-independent driver for the SparkFun Qwiic MEMS gas sensor breakouts. More... | |
Typedefs | |
| typedef enum sfe_gmx02b_sensor_t | sfe_gmx02b_sensor_t |
| The Winsen GM-x02B sensing elements carried by the SparkFun Qwiic gas sensor boards. | |
| typedef enum sfe_gmx02b_cycle_time_t | sfe_gmx02b_cycle_time_t |
| Cycle time settings for the ADC101C021's automatic conversion mode. | |
Enumerations | |
| enum | sfe_gmx02b_sensor_t : uint8_t { GM_102B = 0 , GM_202B , GM_302B , GM_402B , GM_502B , GM_512B , GM_602B , GM_702B , GM_802B , GM_PART_COUNT , GM_UNKNOWN = 0xFF } |
| The Winsen GM-x02B sensing elements carried by the SparkFun Qwiic gas sensor boards. More... | |
| enum | sfe_gmx02b_cycle_time_t : uint8_t { GM_CYCLE_DISABLED = 0x00 , GM_CYCLE_TIME_32 = 0x01 , GM_CYCLE_TIME_64 = 0x02 , GM_CYCLE_TIME_128 = 0x03 , GM_CYCLE_TIME_256 = 0x04 , GM_CYCLE_TIME_512 = 0x05 , GM_CYCLE_TIME_1024 = 0x06 , GM_CYCLE_TIME_2048 = 0x07 } |
| Cycle time settings for the ADC101C021's automatic conversion mode. More... | |
Functions | |
| const sfe_gmx02b_part_t * | sfe_gmx02b_partInfo (sfe_gmx02b_sensor_t sensor) |
| Get the descriptor for a family member. | |
| const char * | sfe_gmx02b_partName (sfe_gmx02b_sensor_t sensor) |
| Get a printable part name. | |
| const char * | sfe_gmx02b_targetGas (sfe_gmx02b_sensor_t sensor) |
| Get a printable target gas description. | |
Header file for the SparkFun Winsen GM-X02B MEMS Gas Sensor Driver.
sfDevGMX02B is a comms-agnostic driver for the SparkFun Qwiic MEMS gas sensor breakouts, built on the SparkFun Toolkit. The boards share one design: a Winsen GM-x02B metal-oxide semiconductor (MOS) sensing element in series with a load resistor, read by a Texas Instruments ADC101C021 10-bit I2C ADC. Nine sensor variants are covered, one per target gas, each shipping at a unique default I2C address so multiple boards can share a bus.
The ADC101C021 also provides a programmable out-of-range alert function: with automatic conversion mode enabled, the ADC monitors the sensor continuously in hardware and flags (or signals on its ALERT pin) whenever the reading crosses a programmable high or low limit, with no polling required. The lowest and highest conversion results are tracked in hardware as well.
SPDX-License-Identifier: MIT
| typedef enum sfe_gmx02b_cycle_time_t sfe_gmx02b_cycle_time_t |
Cycle time settings for the ADC101C021's automatic conversion mode.
In automatic conversion mode the ADC samples the sensor on its own at the selected interval (expressed as multiples of the ~1 us conversion time), keeps the conversion result register fresh, tracks the lowest / highest conversions, and evaluates the alert limits after every conversion. GM_CYCLE_DISABLED (the power-on default) returns the ADC to normal mode, where a new conversion only occurs when the conversion result register is read.
| typedef enum sfe_gmx02b_sensor_t sfe_gmx02b_sensor_t |
The Winsen GM-x02B sensing elements carried by the SparkFun Qwiic gas sensor boards.
These are ordinals, not I2C addresses; they index the per-part descriptor table. Use sfe_gmx02b_partInfo() or getDefaultAddress() to obtain a part's factory address.
| enum sfe_gmx02b_cycle_time_t : uint8_t |
Cycle time settings for the ADC101C021's automatic conversion mode.
In automatic conversion mode the ADC samples the sensor on its own at the selected interval (expressed as multiples of the ~1 us conversion time), keeps the conversion result register fresh, tracks the lowest / highest conversions, and evaluates the alert limits after every conversion. GM_CYCLE_DISABLED (the power-on default) returns the ADC to normal mode, where a new conversion only occurs when the conversion result register is read.
| enum sfe_gmx02b_sensor_t : uint8_t |
The Winsen GM-x02B sensing elements carried by the SparkFun Qwiic gas sensor boards.
These are ordinals, not I2C addresses; they index the per-part descriptor table. Use sfe_gmx02b_partInfo() or getDefaultAddress() to obtain a part's factory address.
| const sfe_gmx02b_part_t * sfe_gmx02b_partInfo | ( | sfe_gmx02b_sensor_t | sensor | ) |
Get the descriptor for a family member.
| sensor | The sensor variant. |
sensor is not a valid variant. | const char * sfe_gmx02b_partName | ( | sfe_gmx02b_sensor_t | sensor | ) |
Get a printable part name.
| sensor | The sensor variant. |
| const char * sfe_gmx02b_targetGas | ( | sfe_gmx02b_sensor_t | sensor | ) |
Get a printable target gas description.
| sensor | The sensor variant. |