Skip to content

Commit fca9564

Browse files
authored
Merge pull request #901 from adafruit/add-skills-refactor
Add skills refactor
2 parents 1023cad + 43d9e9b commit fca9564

File tree

8 files changed

+782
-0
lines changed

8 files changed

+782
-0
lines changed

.agents/skills/add-sensor-component-v1/SKILL.md

Lines changed: 626 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"skill_name": "add_sensor_component_v1",
3+
"evals": [
4+
{
5+
"id": 1,
6+
"prompt": "Add the TMP119 temperature sensor to WipperSnapper. It uses the Adafruit TMP117 library which already has TMP119 support built in. The TMP117 driver already exists as a reference.",
7+
"expected_output": "Creates WipperSnapper_I2C_Driver_TMP119.h based on TMP117 driver, registers it in WipperSnapper_I2C.h and .cpp, identifies that platformio.ini already has the TMP117 library so no change needed, and creates a definition.json for the components repo with I2C addresses 0x48-0x4B and ambient-temp + ambient-temp-fahrenheit subcomponents.",
8+
"files": []
9+
},
10+
{
11+
"id": 2,
12+
"prompt": "I want to add an SCD30 CO2 sensor to wippersnapper but it looks like it might already exist. Can you check and if not, walk me through adding it?",
13+
"expected_output": "Identifies that the SCD30 driver already exists in the drivers folder and informs the user, rather than creating a duplicate.",
14+
"files": []
15+
},
16+
{
17+
"id": 3,
18+
"prompt": "Add the BMP581 barometric pressure sensor to WipperSnapper. It measures temperature, pressure, and altitude.",
19+
"expected_output": "Checks if driver already exists (BMP5XX covers BMP580/581/585), identifies the existing driver handles this, and advises that only a components definition may be needed if not already present.",
20+
"files": []
21+
}
22+
]
23+
}

.claude/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# `.claude/` — Claude Code-specific configuration
2+
3+
Agent skills are canonical in `.agents/skills/` and shared across all harnesses (Claude Code, OpenCode, Cursor, etc.). This directory contains only Claude Code-specific configuration that cannot be made tool-agnostic.
4+
5+
## Contents (Future use)
6+
7+
- `agents/` — Sub-agent persona definitions with Claude Code-specific frontmatter (`model`, `memory`, `color`, `tools`).
8+
- `agent-memory/` — Persistent agent memory files. Claude Code runtime state, not portable across tools.

.claude/skills

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.agents/skills/

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@ tests/
6161
venv/
6262

6363
Doxyfile
64+
65+
.repos/
66+
repos/
67+
Wippersnapper_Components/
68+
Wippersnapper_Boards/

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,17 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
657657
_tmp117->configureDriver(msgDeviceInitReq);
658658
drivers.push_back(_tmp117);
659659
WS_DEBUG_PRINTLN("TMP117 Initialized Successfully!");
660+
} else if (strcmp("tmp119", msgDeviceInitReq->i2c_device_name) == 0) {
661+
_tmp119 = new WipperSnapper_I2C_Driver_TMP119(this->_i2c, i2cAddress);
662+
if (!_tmp119->begin()) {
663+
WS_DEBUG_PRINTLN("ERROR: Failed to initialize TMP119!");
664+
_busStatusResponse =
665+
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
666+
return false;
667+
}
668+
_tmp119->configureDriver(msgDeviceInitReq);
669+
drivers.push_back(_tmp119);
670+
WS_DEBUG_PRINTLN("TMP119 Initialized Successfully!");
660671
} else if (strcmp("tsl2591", msgDeviceInitReq->i2c_device_name) == 0) {
661672
_tsl2591 = new WipperSnapper_I2C_Driver_TSL2591(this->_i2c, i2cAddress);
662673
if (!_tsl2591->begin()) {

src/components/i2c/WipperSnapper_I2C.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
#include "drivers/WipperSnapper_I2C_Driver_SPA06_003.h"
8181
#include "drivers/WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor.h"
8282
#include "drivers/WipperSnapper_I2C_Driver_TMP117.h"
83+
#include "drivers/WipperSnapper_I2C_Driver_TMP119.h"
8384
#include "drivers/WipperSnapper_I2C_Driver_TSL2591.h"
8485
#include "drivers/WipperSnapper_I2C_Driver_VCNL4020.h"
8586
#include "drivers/WipperSnapper_I2C_Driver_VCNL4040.h"
@@ -196,6 +197,7 @@ class WipperSnapper_Component_I2C {
196197
WipperSnapper_I2C_Driver_MS8607 *_ms8607 = nullptr;
197198
WipperSnapper_I2C_Driver_NAU7802 *_nau7802 = nullptr;
198199
WipperSnapper_I2C_Driver_TMP117 *_tmp117 = nullptr;
200+
WipperSnapper_I2C_Driver_TMP119 *_tmp119 = nullptr;
199201
WipperSnapper_I2C_Driver_TSL2591 *_tsl2591 = nullptr;
200202
WipperSnapper_I2C_Driver_VCNL4020 *_vcnl4020 = nullptr;
201203
WipperSnapper_I2C_Driver_VCNL4040 *_vcnl4040 = nullptr;
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*!
2+
* @file WipperSnapper_I2C_Driver_TMP119.h
3+
*
4+
* Device driver for the TMP119 high-accuracy temperature sensor.
5+
*
6+
* Adafruit invests time and resources providing this open source code,
7+
* please support Adafruit and open-source hardware by purchasing
8+
* products from Adafruit!
9+
*
10+
* Copyright (c) Tyeth Gundry 2026 for Adafruit Industries.
11+
*
12+
* MIT license, all text here must be included in any redistribution.
13+
*
14+
*/
15+
#ifndef WipperSnapper_I2C_Driver_TMP119_H
16+
#define WipperSnapper_I2C_Driver_TMP119_H
17+
18+
#include "WipperSnapper_I2C_Driver.h"
19+
#include <Adafruit_TMP119.h>
20+
21+
/**************************************************************************/
22+
/*!
23+
@brief Class that provides a driver interface for the TMP119 sensor.
24+
*/
25+
/**************************************************************************/
26+
class WipperSnapper_I2C_Driver_TMP119 : public WipperSnapper_I2C_Driver {
27+
28+
public:
29+
/*******************************************************************************/
30+
/*!
31+
@brief Constructor for a TMP119 sensor.
32+
@param i2c
33+
The I2C interface.
34+
@param sensorAddress
35+
7-bit device address.
36+
*/
37+
/*******************************************************************************/
38+
WipperSnapper_I2C_Driver_TMP119(TwoWire *i2c, uint16_t sensorAddress)
39+
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
40+
_i2c = i2c;
41+
_sensorAddress = sensorAddress;
42+
}
43+
44+
/*******************************************************************************/
45+
/*!
46+
@brief Destructor for a TMP119 sensor.
47+
*/
48+
/*******************************************************************************/
49+
~WipperSnapper_I2C_Driver_TMP119() { delete _tmp119; }
50+
51+
/*******************************************************************************/
52+
/*!
53+
@brief Initializes the TMP119 sensor and begins I2C.
54+
@returns True if initialized successfully, False otherwise.
55+
*/
56+
/*******************************************************************************/
57+
bool begin() {
58+
_tmp119 = new Adafruit_TMP119();
59+
if (!_tmp119->begin((uint8_t)_sensorAddress, _i2c))
60+
return false;
61+
// Explicit defaults so library changes don't alter WipperSnapper behavior.
62+
if (!_tmp119->setMeasurementMode(TMP117_MODE_CONTINUOUS) ||
63+
!_tmp119->setAveragedSampleCount(TMP117_AVERAGE_8X))
64+
WS_DEBUG_PRINTLN("Failed to reconfigure TMP119 - continuing");
65+
return true;
66+
}
67+
68+
/*******************************************************************************/
69+
/*!
70+
@brief Gets the TMP119's current temperature.
71+
@param tempEvent
72+
Pointer to an Adafruit_Sensor event.
73+
@returns True if the temperature was obtained successfully, False
74+
otherwise.
75+
*/
76+
/*******************************************************************************/
77+
bool getEventAmbientTemp(sensors_event_t *tempEvent) {
78+
if (!_readSensor())
79+
return false;
80+
*tempEvent = _cachedTemp;
81+
return true;
82+
}
83+
84+
protected:
85+
Adafruit_TMP119 *_tmp119 = nullptr; ///< TMP119 driver object
86+
unsigned long _lastRead = 0; ///< Last sensor read time in ms
87+
sensors_event_t _cachedTemp = {0}; ///< Cached temperature event
88+
89+
/*******************************************************************************/
90+
/*!
91+
@brief Reads the TMP119 sensor data, caching the result so only
92+
the first call per cycle performs the I2C transaction.
93+
@returns True if sensor data is available, False otherwise.
94+
*/
95+
/*******************************************************************************/
96+
bool _readSensor() {
97+
if (_lastRead != 0 && millis() - _lastRead < 1000)
98+
return true; // use cached value
99+
if (!_tmp119->getEvent(&_cachedTemp))
100+
return false;
101+
_lastRead = millis();
102+
return true;
103+
}
104+
};
105+
106+
#endif // WipperSnapper_I2C_Driver_TMP119_H

0 commit comments

Comments
 (0)