|
@@ -1,18 +1,24 @@
|
1
|
|
-# pd-buddy-python
|
|
1
|
+pd-buddy-python
|
|
2
|
+===============
|
2
|
3
|
|
3
|
|
-Python library for working with the PD Buddy Sink Serial Console Configuration
|
4
|
|
-Interface
|
|
4
|
+Python library for working with the PD Buddy Sink Serial Console
|
|
5
|
+Configuration Interface
|
5
|
6
|
|
6
|
|
-## Features
|
|
7
|
+Features
|
|
8
|
+--------
|
7
|
9
|
|
8
|
|
-* Provides a Pythonic interface to the PD Buddy Sink shell commands
|
9
|
|
-* Configuration is represented as a SinkConfig object
|
10
|
|
-* SinkConfig objects can be manipulated locally and written to the device with
|
11
|
|
- one method call
|
|
10
|
+- Provides a Pythonic interface to the PD Buddy Sink shell commands
|
|
11
|
+- Configuration is represented as a SinkConfig object
|
|
12
|
+- SinkConfig objects can be manipulated locally and written to the
|
|
13
|
+ device with one method call
|
12
|
14
|
|
13
|
|
-## Examples
|
|
15
|
+Examples
|
|
16
|
+--------
|
14
|
17
|
|
15
|
|
-### Open the first PD Buddy Sink device and read its configuration
|
|
18
|
+Open the first PD Buddy Sink device and read its configuration
|
|
19
|
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
20
|
+
|
|
21
|
+::
|
16
|
22
|
|
17
|
23
|
>>> import pdbuddy
|
18
|
24
|
>>> pdbs = pdbuddy.Sink(list(pdbuddy.Sink.get_devices())[0])
|
|
@@ -24,7 +30,10 @@ Interface
|
24
|
30
|
v: 5.00 V
|
25
|
31
|
i: 3.00 A
|
26
|
32
|
|
27
|
|
-### Locally manipulate a SinkConfig object
|
|
33
|
+Locally manipulate a SinkConfig object
|
|
34
|
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
35
|
+
|
|
36
|
+::
|
28
|
37
|
|
29
|
38
|
>>> cfg = pdbs.get_cfg()
|
30
|
39
|
>>> cfg.v = 20000
|
|
@@ -33,14 +42,18 @@ Interface
|
33
|
42
|
>>> cfg
|
34
|
43
|
SinkConfig(status=SinkStatus.VALID, flags=SinkFlags.GIVEBACK, v=20000, i=2250)
|
35
|
44
|
|
36
|
|
-### Write the SinkConfig object to flash
|
|
45
|
+Write the SinkConfig object to flash
|
|
46
|
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
47
|
+
|
|
48
|
+::
|
37
|
49
|
|
38
|
50
|
>>> pdbs.set_tmpcfg(cfg)
|
39
|
51
|
>>> pdbs.write()
|
40
|
52
|
>>> pdbs.get_cfg()
|
41
|
53
|
SinkConfig(status=SinkStatus.VALID, flags=SinkFlags.GIVEBACK, v=20000, i=2250)
|
42
|
54
|
|
43
|
|
-## Requirements
|
|
55
|
+Requirements
|
|
56
|
+------------
|
44
|
57
|
|
45
|
|
-* Python >= 3.6
|
46
|
|
-* pySerial >= 3.0
|
|
58
|
+- Python >= 3.6
|
|
59
|
+- pySerial >= 3.0
|