Namespace Harp.Hobgoblin
Harp Hobgoblin
A simple multi-purpose device for learning the basics of the Harp standard. Although the repository contains working device metadata, firmware and high-level interface, the Harp Hobgoblin device is made to be adapted and modified for a variety of purposes.
Assembling the device
The Harp Hobgoblin is designed to operate directly from a Raspberry Pi Pico / Pico 2 board. To make it easier to interface with a variety of inputs and outputs we recommend the Gravity: Expansion Board.
Note
The following links are provided as a reference only. We are not connected to or in any other way affiliated with the suppliers listed below.
- Raspberry Pi Pico:
- Gravity Sensors:
Flashing the firmware
- Press-and-hold the Pico BOOTSEL button while you connect the device to the computer USB port.
- Drag-and-drop the
.uf2
file matching your Pico board into the new storage device that appears on your PC.
Using the device
Harp Hobgoblin is designed for use with the Bonsai visual reactive programming language.
- Install the
Harp.Hobgoblin
package using the Bonsai package manager. - Insert the
Device
source from the editor toolbox. - For additional documentation and examples, refer to the official Harp documentation.
Building the firmware
Prerequisites
- Install Visual Studio Code.
- Install the Raspberry Pi Pico extension.
- Update the Harp Core submodule:
git submodule update --init --recursive
Follow the steps outlined in Firmware/README.md.
Editing device metadata
Prerequisites
- Install Visual Studio Code.
- Install the YAML extension.
The device.yml
file in the root of the project contains the Hobgoblin device metadata. A complete specification of all device registers, including bit masks, group masks, and payload formats needs to be provided.
Generating the device interface
Prerequisites
- Install
dotnet
. - Install
dotnet-t4
.
dotnet tool install -g dotnet-t4
The Generators
folder contains all text templates and project files required to generate both the firmware headers and the interface for the Hobgoblin device. To run the text templating engine just build the project inside this folder.
dotnet build Generators
Hobgoblin | |
---|---|
whoAmI | 123 |
firmwareVersion | 0.1 |
hardwareTargets | 1.0 |
Registers
name | address | type | length | access | description | range | interfaceType |
---|---|---|---|---|---|---|---|
DigitalInputState | 32 | U8 | Event | Reflects the state of the digital input lines. | DigitalInputs | ||
DigitalOutputSet | 33 | U8 | Write, Event | Sets the specified digital output lines. | DigitalOutputs | ||
DigitalOutputClear | 34 | U8 | Write, Event | Clears the specified digital output lines. | DigitalOutputs | ||
DigitalOutputToggle | 35 | U8 | Write, Event | Toggles the specified digital output lines. | DigitalOutputs | ||
DigitalOutputState | 36 | U8 | Write, Event | Writes the state of all digital output lines. | DigitalOutputs | ||
StartPulseTrain | 37 | U32 | 4 | Write | Starts a pulse train driving the specified digital output lines. | StartPulseTrainPayload | |
StopPulseTrain | 38 | U8 | Write, Event | Stops the pulse train running on the specified digital output lines. | DigitalOutputs | ||
AnalogData | 39 | U16 | 3 | Event | Reports the sampled analog signal on each of the ADC input channels. The ADC is capped at 12 bits of resolution. | AnalogDataPayload |
Classes
- AnalogData
Represents a register that reports the sampled analog signal on each of the ADC input channels. The ADC is capped at 12 bits of resolution.
- AsyncDevice
Represents an asynchronous API to configure and interface with Hobgoblin devices.
- CreateAnalogDataPayload
Represents an operator that creates a message payload that reports the sampled analog signal on each of the ADC input channels. The ADC is capped at 12 bits of resolution.
- CreateDigitalInputStatePayload
Represents an operator that creates a message payload that reflects the state of the digital input lines.
- CreateDigitalOutputClearPayload
Represents an operator that creates a message payload that clears the specified digital output lines.
- CreateDigitalOutputSetPayload
Represents an operator that creates a message payload that sets the specified digital output lines.
- CreateDigitalOutputStatePayload
Represents an operator that creates a message payload that writes the state of all digital output lines.
- CreateDigitalOutputTogglePayload
Represents an operator that creates a message payload that toggles the specified digital output lines.
- CreateMessage
Represents an operator which creates standard message payloads for the Hobgoblin device.
- CreateStartPulseTrainPayload
Represents an operator that creates a message payload that starts a pulse train driving the specified digital output lines.
- CreateStopPulseTrainPayload
Represents an operator that creates a message payload that stops the pulse train running on the specified digital output lines.
- CreateTimestampedAnalogDataPayload
Represents an operator that creates a timestamped message payload that reports the sampled analog signal on each of the ADC input channels. The ADC is capped at 12 bits of resolution.
- CreateTimestampedDigitalInputStatePayload
Represents an operator that creates a timestamped message payload that reflects the state of the digital input lines.
- CreateTimestampedDigitalOutputClearPayload
Represents an operator that creates a timestamped message payload that clears the specified digital output lines.
- CreateTimestampedDigitalOutputSetPayload
Represents an operator that creates a timestamped message payload that sets the specified digital output lines.
- CreateTimestampedDigitalOutputStatePayload
Represents an operator that creates a timestamped message payload that writes the state of all digital output lines.
- CreateTimestampedDigitalOutputTogglePayload
Represents an operator that creates a timestamped message payload that toggles the specified digital output lines.
- CreateTimestampedStartPulseTrainPayload
Represents an operator that creates a timestamped message payload that starts a pulse train driving the specified digital output lines.
- CreateTimestampedStopPulseTrainPayload
Represents an operator that creates a timestamped message payload that stops the pulse train running on the specified digital output lines.
- Device
Represents an observable source of messages from the Harp device connected at the specified serial port.
- DeviceDataWriter
Represents an operator that writes the sequence of Harp.Hobgoblin" messages to the standard Harp storage format.
- DigitalInputState
Represents a register that reflects the state of the digital input lines.
- DigitalOutputClear
Represents a register that clears the specified digital output lines.
- DigitalOutputSet
Represents a register that sets the specified digital output lines.
- DigitalOutputState
Represents a register that writes the state of all digital output lines.
- DigitalOutputToggle
Represents a register that toggles the specified digital output lines.
- FilterRegister
Represents an operator that filters register-specific messages reported by the Harp.Hobgoblin device.
- Format
Represents an operator which formats a sequence of values as specific Hobgoblin register messages.
- GetDeviceMetadata
Represents an operator that returns the contents of the metadata file describing the Harp.Hobgoblin device registers.
- GroupByRegister
Represents an operator that groups the sequence of Harp.Hobgoblin" messages by register type.
- Parse
Represents an operator which filters and selects specific messages reported by the Hobgoblin device.
- StartPulseTrain
Represents a register that starts a pulse train driving the specified digital output lines.
- StopPulseTrain
Represents a register that stops the pulse train running on the specified digital output lines.
- TimestampedAnalogData
Provides methods for manipulating timestamped messages from the AnalogData register.
- TimestampedDigitalInputState
Provides methods for manipulating timestamped messages from the DigitalInputState register.
- TimestampedDigitalOutputClear
Provides methods for manipulating timestamped messages from the DigitalOutputClear register.
- TimestampedDigitalOutputSet
Provides methods for manipulating timestamped messages from the DigitalOutputSet register.
- TimestampedDigitalOutputState
Provides methods for manipulating timestamped messages from the DigitalOutputState register.
- TimestampedDigitalOutputToggle
Provides methods for manipulating timestamped messages from the DigitalOutputToggle register.
- TimestampedStartPulseTrain
Provides methods for manipulating timestamped messages from the StartPulseTrain register.
- TimestampedStopPulseTrain
Provides methods for manipulating timestamped messages from the StopPulseTrain register.
Structs
- AnalogDataPayload
Represents the payload of the AnalogData register.
- StartPulseTrainPayload
Represents the payload of the StartPulseTrain register.
Enums
- DigitalInputs
Specifies the state of port digital input lines.
- DigitalOutputs
Specifies the state of port digital output lines.