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
Loading...
Searching...
No Matches
sfDevGMX02B.cpp File Reference

Implementation file for the SparkFun Winsen GM-X02B MEMS Gas Sensor Driver. More...

#include "sfDevGMX02B.h"
#include <math.h>

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.
 

Variables

static const sfe_gmx02b_part_t kGMParts [GM_PART_COUNT]
 Per-part descriptor table, one row per GM-x02B variant in sfe_gmx02b_sensor_t order.
 

Detailed Description

Implementation file for the SparkFun Winsen GM-X02B MEMS Gas Sensor Driver.

Implements sfDevGMX02B: register-level access to the onboard ADC101C021, the load-resistor divider math, the nine-row per-part descriptor table, and the direction-normalized gas response that lets one API serve both reducing-gas parts (Rs falls with gas) and the GM-102B (Rs rises).

Author
SparkFun Electronics
Date
September 2026

SPDX-License-Identifier: MIT

See also
https://github.com/sparkfun/SparkFun_GM-X02B_Arduino_Library

Function Documentation

◆ sfe_gmx02b_partInfo()

const sfe_gmx02b_part_t * sfe_gmx02b_partInfo ( sfe_gmx02b_sensor_t sensor)

Get the descriptor for a family member.

Parameters
sensorThe sensor variant.
Returns
Pointer to the const descriptor, or nullptr if sensor is not a valid variant.

◆ sfe_gmx02b_partName()

const char * sfe_gmx02b_partName ( sfe_gmx02b_sensor_t sensor)

Get a printable part name.

Parameters
sensorThe sensor variant.
Returns
A string such as "GM-602B", or "Unknown".

◆ sfe_gmx02b_targetGas()

const char * sfe_gmx02b_targetGas ( sfe_gmx02b_sensor_t sensor)

Get a printable target gas description.

Parameters
sensorThe sensor variant.
Returns
A string such as "H2S", or "Unknown".

Variable Documentation

◆ kGMParts

const sfe_gmx02b_part_t kGMParts[GM_PART_COUNT]
static

Per-part descriptor table, one row per GM-x02B variant in sfe_gmx02b_sensor_t order.