Skip to content

Commit d4f9f04

Browse files
committed
Added sphinx comment for encoder __init__ and fixed other small issues
1 parent efcfe72 commit d4f9f04

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

XRPLib/encoder.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ class Encoder:
1010
ticks_per_rev = _ticks_per_motor_shaft_revolution * _gear_ratio # 585
1111

1212
def __init__(self, index, encAPin, encBPin):
13+
"""
14+
Uses the on board PIO State Machine to keep track of encoder positions.
15+
Only 4 encoders can be instantiated this way.
16+
17+
:param index: The index of the state machine to be used, indexed 0-3.
18+
:type index: int
19+
:param encAPin: The pin the left reflectance sensor is connected to
20+
:type encAPin: int
21+
:param encBPin: The pin the right reflectance sensor is connected to
22+
:type encBPin: int
23+
"""
1324
if(abs(encAPin - encBPin) != 1):
1425
raise Exception("Encoder pins must be successive!")
1526
basePin = machine.Pin(min(encAPin, encBPin))

XRPLib/rangefinder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, trigger_pin:int, echo_pin:int, timeout_us:int=500*2*30):
2121
Timeouts will return a MAX_VALUE (65535) instead of raising an exception.
2222
2323
:param trigger_pin: The number of the pin on the microcontroller that's connected to the ``Trig`` pin on the HC-SR04.
24-
:type trig_pin: int
24+
:type trigger_pin: int
2525
:param echo_pin: The number of the pin on the microcontroller that's connected to the ``Echo`` pin on the HC-SR04.
2626
:type echo_pin: int
2727
:param timeout_us: Max microseconds seconds to wait for a response from the sensor before assuming it isn't going to answer. By default set to 30,000 us (0.03 s)

0 commit comments

Comments
 (0)