You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/skills/pyhardwarelibrary/SKILL.md
+44-1Lines changed: 44 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: pyhardwarelibrary
3
-
description: Control lab hardware with the PyHardwareLibrary Python package — motion stages, spectrometers, lasers, power meters, DAQs, and oscilloscopes. Use when a user wants to move a stage, acquire a spectrum, turn a laser on/off or set its power/wavelength, read a power meter, read/write DAQ voltages, discover connected devices, run code without hardware (debug devices), or build a headless/GUI controller around a device. Covers the device lifecycle, per-family public API, event notifications, and the DeviceController worker-thread wrapper.
3
+
description: Control lab hardware with the PyHardwareLibrary Python package — motion stages, spectrometers, lasers, power meters, DAQs, oscilloscopes, and USB power strips. Use when a user wants to move a stage, acquire a spectrum, turn a laser on/off or set its power/wavelength, read a power meter, read/write DAQ voltages, switch power-strip outlets on/off, discover connected devices, run code without hardware (debug devices), or build a headless/GUI controller around a device. Covers the device lifecycle, per-family public API, event notifications, and the DeviceController worker-thread wrapper.
4
4
---
5
5
6
6
# Using PyHardwareLibrary
@@ -10,6 +10,15 @@ subclass with a uniform lifecycle and a small, predictable public API per family
10
10
skill is for *using* devices to get work done (move, measure, set). To *write a new
11
11
driver*, read `CLAUDE.md` and `README-4-New-device-coding-example.md` instead.
12
12
13
+
**Use the primitives from `CommunicationPort` for all communications.** A driver's `do*`
14
+
methods talk to hardware only through `self.port` — `writeData` / `readData` (and the
15
+
`readString` / `writeString` / `writeStringReadMatch` helpers built on them). Do **not**
16
+
invent new send/receive helpers on the device (no `_sendCommandByte`, no `_query`); call
17
+
the port methods directly. To support a new transport (serial, USB, HID, TCP, ...),
18
+
subclass `CommunicationPort` and go through the expected mechanism of **overriding
19
+
`readData` and `writeData`** (plus `open` / `close` / `isOpen` / `flush`) — the string and
20
+
transaction helpers then compose on top for free. `HIDPort` is the reference example.
21
+
13
22
## The one rule: lifecycle
14
23
15
24
Every device follows the same pattern. Construct it, initialize it, use it, shut it down.
0 commit comments