Skip to content

Commit 6c998a2

Browse files
committed
Add short usage instructions to README file
1 parent 9043f7e commit 6c998a2

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,31 @@ datamodel-codegen --input ./reflex-generator/schema/device.json --output harp/mo
1212

1313
> [!IMPORTANT]
1414
> Currently code generation adds an unwanted field at the very end of the data model definition `registers: Optional[Any] = None`. This declaration needs to be removed for serialization to work properly.
15+
16+
## How to use
17+
18+
### Read Harp device schema from YML file
19+
20+
```python
21+
from harp.schema import read_schema
22+
schema = read_schema('device.yml')
23+
```
24+
25+
### Create device reader object from schema
26+
27+
```python
28+
from harp.reader import create_reader
29+
reader = create_reader(schema)
30+
```
31+
32+
### Read data from named register
33+
34+
```python
35+
reader.OperationControl.read("data/Behavior_10.bin")
36+
```
37+
38+
### Access register metadata
39+
40+
```python
41+
reader.OperationControl.register.address
42+
```

0 commit comments

Comments
 (0)