Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
64 changes: 64 additions & 0 deletions .github/workflows/build-deploy-ghpages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build Documentation and Deploy

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
id-token: write
pages: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: "true"

- name: Set Version
run: echo "PROJECT_NUMBER = `git describe --tags`" >> ./docs/doxygen/doxygen-config

- name: Build Documentation
uses: mattnotmitt/doxygen-action@v1.9.5
with:
doxyfile-path: "./docs/doxygen/doxygen-config"

# Upload the documentation as an artifact
- name: Upload documentation
uses: actions/upload-pages-artifact@v3.0.1
with:
path: ./docs/html

# Deploy job
deploy:
# Add a dependency to the build job
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
91 changes: 91 additions & 0 deletions .github/workflows/test-compile-sketch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Cross-compilation Library Test

on:
push:
branches:
- main
Comment on lines +3 to +6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile CI doesn't run on develop branch pushes — test-compile-sketch.yml triggers on push to main and on PRs, but not on develop. Commits pushed directly to develop without opening a PR get no compile check. Consider adding develop to the push trigger.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care to test on the develop branch? I think main only is fine

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

pull_request:
workflow_dispatch:

jobs:
compile-sketch:
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
board:
# Uno / AVR (Mega has the flash headroom for the examples)
- fqbn: arduino:avr:mega
name: arduino:avr
source-url: https://downloads.arduino.cc/packages/package_index.json

# ESP32
- fqbn: esp32:esp32:esp32
name: esp32:esp32
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

# ESP32-C3
- fqbn: esp32:esp32:esp32c3
name: esp32:esp32
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

# ESP8266
- fqbn: esp8266:esp8266:thingdev
name: esp8266:esp8266
source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json

# SAMD21
- fqbn: arduino:samd:mkr1000
name: arduino:samd
source-url: https://downloads.arduino.cc/packages/package_index.json

# Nano BLE 33 / nRF52840
- fqbn: arduino:mbed:nano33ble
name: arduino:mbed
source-url: https://downloads.arduino.cc/packages/package_index.json

# RP2040
- fqbn: rp2040:rp2040:sparkfun_promicrorp2040
name: rp2040:rp2040
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

# RP2350
- fqbn: rp2040:rp2040:sparkfun_promicrorp2350
name: rp2040:rp2040
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

# STM32
- fqbn: STMicroelectronics:stm32:GenF4
name: STMicroelectronics:stm32
source-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}

- name: Arduino - Install and setup the Arduino CLI
uses: arduino/setup-arduino-cli@v2

- name: Arduino - Start config file
run: arduino-cli config init --additional-urls ${{ matrix.board.source-url}}

- name: Arduino - Update index
run: arduino-cli core update-index

- name: Arduino - Install platform
run: arduino-cli core install ${{ matrix.board.name}}

- name: Arduino - Install library dependencies
run: arduino-cli lib install "SparkFun Toolkit"

- name: Compile Sketches
run: |
for example in examples/*/; do
echo "Compiling $example"
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} "$example" --library .
done
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Local tool settings
.claude/

# Doxygen output (built and deployed by CI)
docs/html/

# OS cruft
.DS_Store
Thumbs.db
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "docs/doxygen/doxygen-awesome-css"]
path = docs/doxygen/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ int16_t correction = 0;
mySensor.performForcedRecalibration(420, correction); // outdoor air ~420 ppm
```

`performFactoryReset()` clears all recalibration and self-calibration history. After more than 3 hours without power, `performConditioning()` (a one-off, blocking 22 s routine) is recommended to speed the sensor back to full accuracy.
`performFactoryReset()` clears all recalibration and self-calibration history. After more than 3 hours without power, `performConditioning()` is recommended to speed the sensor back to full accuracy.

> [!IMPORTANT]
> `performConditioning()` **blocks for about 22 seconds** while the sensor runs its conditioning profile — the call does not return until it finishes. This is by far the longest-blocking call in the library, so run it once at startup (not inside `loop()`), and don't mistake the pause for a hang. Start a measurement afterwards.

## Examples

Expand Down
1 change: 1 addition & 0 deletions docs/doxygen/doxygen-awesome-css
Submodule doxygen-awesome-css added at d52eaf
61 changes: 61 additions & 0 deletions docs/doxygen/doxygen-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Doxygen configuration for the SparkFun STCC4 Arduino Library
# The CI workflow appends a PROJECT_NUMBER line (from git describe) before running.

DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "SparkFun Qwiic CO2 Sensor - STCC4"
PROJECT_BRIEF = "Arduino Library for the SparkFun Qwiic CO2 Sensor (STCC4)"
OUTPUT_DIRECTORY = ./docs
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OPTIMIZE_OUTPUT_FOR_C = NO
MARKDOWN_SUPPORT = YES
AUTOLINK_SUPPORT = YES

# Extraction
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
HIDE_UNDOC_MEMBERS = NO
JAVADOC_AUTOBRIEF = YES

# Input
INPUT = src \
README.md \
docs
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h *.cpp *.md
RECURSIVE = YES
IMAGE_PATH = docs/images
USE_MDFILE_AS_MAINPAGE = README.md

# HTML output
GENERATE_HTML = YES
HTML_OUTPUT = html
GENERATE_TREEVIEW = YES
DISABLE_INDEX = NO
FULL_SIDEBAR = NO

# SparkFun branding (doxygen-awesome-css theme + custom header/logo)
PROJECT_LOGO = ./docs/images/sfe_flame.png
HTML_HEADER = ./docs/doxygen/doxygen-custom/header.html
HTML_EXTRA_STYLESHEET = docs/doxygen/doxygen-awesome-css/doxygen-awesome.css \
docs/doxygen/doxygen-awesome-css/doxygen-awesome-sidebar-only.css \
docs/doxygen/doxygen-custom/custom.css
HTML_EXTRA_FILES = docs/images/sfe_flame.png
HTML_COLORSTYLE = AUTO_LIGHT
HTML_COLORSTYLE_HUE = 209
HTML_COLORSTYLE_SAT = 255
HTML_COLORSTYLE_GAMMA = 113

# Disable other generators
GENERATE_LATEX = NO
GENERATE_XML = NO
GENERATE_RTF = NO
GENERATE_MAN = NO

# Diagrams
HAVE_DOT = NO

# Warnings
QUIET = YES
WARN_IF_UNDOCUMENTED = NO
21 changes: 21 additions & 0 deletions docs/doxygen/doxygen-custom/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
:root {
--side-nav-fixed-width: 300px;
}

.github-corner svg {
fill: var(--primary-light-color);
color: var(--page-background-color);
width: 72px;
height: 72px;
}

#projectnumber {
margin-right: 22px;
}

@media screen and (max-width: 767px) {
.github-corner svg {
width: 55px;
height: 55px;
}
}
123 changes: 123 additions & 0 deletions docs/doxygen/doxygen-custom/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<!-- HTML header for doxygen 1.9.1-->
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta name="generator" content="Doxygen $doxygenversion" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!-- BEGIN opengraph metadata -->
<meta property="og:title" content="SparkFun STCC4 Arduino Library" />
<meta property="og:description" content="Arduino Library for the SparkFun Qwiic CO2 Sensor (STCC4)" />
<meta property="og:url" content="https://docs.sparkfun.com/SparkFun_STCC4_Arduino_Library" />
<!-- END opengraph metadata -->

<!-- BEGIN twitter metadata -->
<meta name="twitter:title" content="SparkFun STCC4 Arduino Library" />
<meta name="twitter:description" content="Arduino Library for the SparkFun Qwiic CO2 Sensor (STCC4)" />
<!-- END twitter metadata -->

<!--BEGIN PROJECT_NAME-->
<title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="sfe_flame.png">
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>

<body>

<!-- https://tholman.com/github-corners/ -->
<a href="https://github.com/sparkfun/SparkFun_STCC4_Arduino_Library" class="github-corner" title="View source on GitHub">
<svg viewBox="0 0 250 250" style="position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor" class="octo-body"></path>
</svg></a>
<style>
.github-corner:hover .octo-arm {
animation: octocat-wave 560ms ease-in-out
}

@keyframes octocat-wave {

0%,
100% {
transform: rotate(0)
}

20%,
60% {
transform: rotate(-25deg)
}

40%,
80% {
transform: rotate(10deg)
}
}

@media (max-width:500px) {
.github-corner:hover .octo-arm {
animation: none
}

.github-corner .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
}
</style>


<div id="top"><!-- do not remove this div, it is closed by doxygen! -->

<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo" /></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER-->&#160;<span
id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF-->
<div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td style="padding-left: 0.5em;">
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<td>$searchbox</td>
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->
Binary file added docs/images/sfe_flame.png

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing banner image: Acknowledged in the PR — docs/images/gh-banner-2026-arduino-stcc4.png is referenced by the README but not included. Should be added before merging.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading