Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a127898
Add first draft of device JSON schema
glopesdev Feb 2, 2023
31e85b0
refactor to generate from json schema
bruno-f-cruz Feb 4, 2023
7ca74c4
set default arrayType to "1"
bruno-f-cruz Feb 4, 2023
d352b01
add masks to schema
bruno-f-cruz Feb 7, 2023
b742e4c
update schema to include an initial proposal of the IO tab
bruno-f-cruz Feb 7, 2023
5e1937a
add architecture to schema
bruno-f-cruz Feb 8, 2023
3a0c987
Reorganize device schema to reuse definitions
glopesdev Feb 8, 2023
88c9ad9
Add extra validation and description fields
glopesdev Feb 8, 2023
ef991e3
Add compact bitmask definition to the schema
glopesdev Feb 8, 2023
8805504
add crossreference class
bruno-f-cruz Feb 9, 2023
f5556a6
update schema
bruno-f-cruz Feb 9, 2023
37bbf1d
Add constraint on minimum register address
glopesdev Feb 10, 2023
0ed6127
Ensure naming conventions on pin schema
glopesdev Feb 10, 2023
bda64de
Remove payload type from bitmask schema
glopesdev Feb 10, 2023
1d155e0
Convert ios and bit masks from sequence to mapping
glopesdev Feb 10, 2023
ee40722
Add support for group masks
glopesdev Feb 10, 2023
4f0c7df
Generalize payload data specification
glopesdev Feb 10, 2023
0ba8110
Use mapping for register collection
glopesdev Feb 10, 2023
9d2c78e
Ensure payloadSpec is discriminated union type
glopesdev Feb 10, 2023
609d8ca
Require masks to specify their underlying type
glopesdev Feb 10, 2023
f009950
Avoid using mixed complex types in schema
glopesdev Feb 10, 2023
3e46e09
Allow adding description to payload members
glopesdev Feb 10, 2023
cea4c0f
Refactor io pin mapping schema
glopesdev Feb 10, 2023
72ce06c
Add minimum constraint to payload length
glopesdev Feb 10, 2023
20bf048
Remove packing size specification from mask schema
glopesdev Feb 10, 2023
a9f55d8
Add support for specifying custom converter method
glopesdev Feb 11, 2023
f1bd9dc
Represent register type as a flags enum type
glopesdev Feb 14, 2023
47ef36e
Reuse payload definitions for type and converter
glopesdev Feb 14, 2023
d20ba7c
Allow specifying min, max and default values
glopesdev Feb 14, 2023
4105479
Update schema to support hybrid type registers
glopesdev Feb 18, 2023
13ac84f
Split specification of high-level interface type
glopesdev Feb 19, 2023
6699b75
Move IO pin configuration into separate schema
glopesdev Feb 19, 2023
e123277
Support description for individual mask values
glopesdev Feb 20, 2023
5df463b
Align schema register type with message type enum
glopesdev Mar 3, 2023
cddcf4e
Split schema into device and register interface
glopesdev Mar 3, 2023
3a00b32
Add metadata for all common harp registers
glopesdev Mar 3, 2023
21a9bdd
Add volatile optional register property
glopesdev Mar 5, 2023
4d93585
Remove unused group property
glopesdev Mar 5, 2023
ae2eb92
Rename core register attributes
glopesdev Mar 6, 2023
4522aae
Reorder schema register attribute declaration
glopesdev Mar 7, 2023
e7ce905
Reorder payload member properties for consistency
glopesdev Mar 8, 2023
e083482
Remove architecture property from device schema
glopesdev Mar 13, 2023
9f6b6ce
Make volatile a boolean field
glopesdev Mar 17, 2023
5bc68dc
Update common register metadata
glopesdev Mar 20, 2023
1d968b9
Add None enum value to common register bitmasks
glopesdev Mar 20, 2023
ff6413f
Ensure correctly formatted strings
glopesdev Mar 20, 2023
121b5b6
Auto-generate converter method declarations
glopesdev Mar 22, 2023
bd4d52a
Update register schema to conform to standard json
glopesdev Nov 18, 2023
0d997c6
Update schema version
glopesdev Nov 18, 2023
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
145 changes: 145 additions & 0 deletions schema/common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# yaml-language-server: $schema=registers.json
registers:
WhoAmI:
address: 0
type: U16
access: Read
description: Specifies the identity class of the device.
HardwareVersionHigh:
address: 1
type: U8
access: Read
description: Specifies the major hardware version of the device.
HardwareVersionLow:
address: 2
type: U8
access: Read
description: Specifies the minor hardware version of the device.
AssemblyVersion:
address: 3
type: U8
access: Read
description: Specifies the version of the assembled components in the device.
CoreVersionHigh:
address: 4
type: U8
access: Read
description: Specifies the major version of the Harp core implemented by the device.
CoreVersionLow:
address: 5
type: U8
access: Read
description: Specifies the minor version of the Harp core implemented by the device.
FirmwareVersionHigh:
address: 6
type: U8
access: Read
description: Specifies the major version of the Harp core implemented by the device.
FirmwareVersionLow:
address: 7
type: U8
access: Read
description: Specifies the minor version of the Harp core implemented by the device.
TimestampSeconds:
address: 8
type: U32
access: [Read, Write, Event]
description: Stores the integral part of the system timestamp, in seconds.
volatile: true
TimestampMicroseconds:
address: 9
type: U16
access: Read
description: Stores the fractional part of the system timestamp, in microseconds.
volatile: true
OperationControl:
address: 10
type: U8
access: Write
description: Stores the configuration mode of the device.
payloadSpec:
OperationMode:
description: Specifies the operation mode of the device.
maskType: OperationMode
mask: 0x3
DumpRegisters:
description: Specifies whether the device should report the content of all registers on initialization.
interfaceType: bool
mask: 0x8
MuteReplies:
description: Specifies whether the replies to all commands will be muted, i.e. not sent by the device.
interfaceType: bool
mask: 0x10
VisualIndicators:
description: Specifies the state of all visual indicators on the device.
maskType: LedState
mask: 0x20
OperationLed:
description: Specifies whether the device state LED should report the operation mode of the device.
maskType: LedState
mask: 0x40
Heartbeat:
description: Specifies whether the device should report the content of the seconds register each second.
maskType: EnableFlag
mask: 0x80
ResetDevice:
address: 11
type: U8
access: Write
maskType: ResetFlags
description: Resets the device and saves non-volatile registers.
DeviceName:
address: 12
type: U8
length: 25
access: Write
description: Stores the user-specified device name.
SerialNumber:
address: 13
type: U16
access: Write
description: Specifies the unique serial number of the device.
ClockConfiguration:
address: 14
type: U8
access: Write
maskType: ClockConfigurationFlags
description: Specifies the configuration for the device synchronization clock.
groupMasks:
OperationMode:
description: Specifies the operation mode of the device.
values:
Standby: {value: 0, description: Disable all event reporting on the device.}
Active: {value: 1, description: Event detection is enabled. Only enabled events are reported by the device.}
Speed: {value: 3, description: The device enters speed mode.}
EnableFlag:
description: Specifies whether a specific register flag is enabled or disabled.
values:
Disabled: {value: 0, description: Specifies that the flag is disabled.}
Enabled: {value: 1, description: Specifies that the flag is enabled.}
LedState:
description: Specifies the state of an LED on the device.
values:
Off: {value: 0, description: Specifies that the LED is off.}
On: {value: 1, description: Specifies that the LED is on.}
bitMasks:
ResetFlags:
description: Specifies the behavior of the non-volatile registers when resetting the device.
bits:
None: {value: 0, description: All reset flags are cleared.}
RestoreDefault: {value: 0x1, description: The device will boot with all the registers reset to their default factory values.}
RestoreEeprom: {value: 0x2, description: The device will boot and restore all the registers to the values stored in non-volatile memory.}
Save: {value: 0x4, description: The device will boot and save all the current register values to non-volatile memory.}
RestoreName: {value: 0x8, description: The device will boot with the default device name.}
BootFromDefault: {value: 0x40, description: Specifies that the device has booted from default factory values.}
BootFromEeprom: {value: 0x80, description: Specifies that the device has booted from non-volatile values stored in EEPROM.}
ClockConfigurationFlags:
description: Specifies configuration flags for the device synchronization clock.
bits:
None: {value: 0, description: All clock configuration flags are cleared.}
ClockRepeater: {value: 0x1, description: "The device will repeat the clock synchronization signal to the clock output connector, if available."}
ClockGenerator: {value: 0x2, description: "The device resets and generates the clock synchronization signal on the clock output connector, if available."}
RepeaterCapability: {value: 0x8, description: Specifies the device has the capability to repeat the clock synchronization signal to the clock output connector.}
GeneratorCapability: {value: 0x10, description: Specifies the device has the capability to generate the clock synchronization signal to the clock output connector.}
ClockUnlock: {value: 0x40, description: The device will unlock the timestamp register counter and will accept commands to set new timestamp values.}
ClockLock: {value: 0x80, description: The device will lock the timestamp register counter and will not accept commands to set new timestamp values.}
36 changes: 36 additions & 0 deletions schema/device.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://harp-tech.org/draft-02/schema/device.json",
"type": "object",
"allOf": [
{
"properties": {
"device": {
"description": "Specifies the name of the device.",
"type": "string"
},
"whoAmI": {
"description": "Specifies the unique identifier for this device type.",
"type": "integer"
},
"firmwareVersion": {
"description": "Specifies the semantic version of the device firmware.",
"type": "string"
},
"hardwareTargets": {
"description": "Specifies the semantic version of the device hardware.",
"type": "string"
},
"registers": {
"additionalProperties": {
"properties": {
"address": { "minimum": 32 }
}
}
}
},
"required": ["device", "whoAmI", "firmwareVersion", "hardwareTargets"]
},
{ "$ref": "registers.json" }
]
}
90 changes: 90 additions & 0 deletions schema/ios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://harp-tech.org/draft-02/schema/ios.json",
"type": "object",
"description": "Specifies the IO pin configuration used to automatically generate firmware.",
"additionalProperties": {
"oneOf": [
{ "$ref": "#/definitions/inputPin" },
{ "$ref": "#/definitions/outputPin" }
]
},
"definitions": {
"portPin": {
"type": "object",
"properties": {
"description": {
"description": "Specifies a summary description of the IO pin function.",
"type": "string"
},
"port": {
"description": "Specifies the microcontroller port where the pin is located.",
"type": "string"
},
"pinNumber": {
"description": "Specifies the unique pin number in the defined port.",
"type": "integer"
},
"direction": {
"description": "Specifies whether the pin will be used as input or output.",
"type": "string",
"enum": ["input", "output"]
}
},
"required": ["port", "pinNumber", "direction"]
},
"inputPin": {
"allOf": [{ "$ref": "#/definitions/portPin" }],
"properties": {
"direction": {
"enum": ["input"]
},
"pinMode": {
"description": "Specifies how the input pin is configured to handle floating inputs.",
"type": "string",
"enum": ["pullup", "pulldown", "tristate", "busholder"]
},
"triggerMode": {
"description": "Specifies when the interrupt event for this pin should be triggered.",
"type": "string",
"enum": ["none", "rising", "falling", "toggle", "low"]
},
"interruptPriority": {
"description": "Specifies the priority of the interrupt event for this pin.",
"type": "string",
"enum": ["off", "low", "medium", "high"]
},
"interruptNumber": {
"description": "Specifies the interrupt number associated with this pin.",
"type": "integer",
"enum": [0, 1]
}
}
},
"outputPin": {
"allOf": [{ "$ref": "#/definitions/portPin" }],
"properties": {
"direction": {
"enum": ["output"]
},
"allowRead": {
"description": "Specifies whether reading the state of the output pin is allowed.",
"type": "boolean"
},
"pinMode": {
"description": "Specifies the output pin wiring configuration.",
"type": "string",
"enum": ["wiredOr", "wiredAnd", "wiredOrPull", "wiredAndPull"]
},
"initialState": {
"description": "Specifies the initial state of the output pin at boot time.",
"enum": ["low", "high"]
},
"invert": {
"description": "Specifies whether the output logic of the pin should be inverted.",
"type": "boolean"
}
}
}
}
}
Loading