Skip to content

Commit 9bddfec

Browse files
committed
QA: Fix DOS line-endings and whitespace.
1 parent 414964b commit 9bddfec

File tree

2 files changed

+181
-181
lines changed

2 files changed

+181
-181
lines changed

REFERENCE.md

Lines changed: 174 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -1,174 +1,174 @@
1-
# Reference <!-- omit in toc -->
2-
3-
- [Getting Started](#getting-started)
4-
- [Installing](#installing)
5-
- [Examples](#examples)
6-
- [Two Motors](#two-motors)
7-
- [Function Reference](#function-reference)
8-
- [set_voltage](#set_voltage)
9-
- [get_voltage](#get_voltage)
10-
- [set_outputs](#set_outputs)
11-
- [brake](#brake)
12-
- [coast](#coast)
13-
- [forward](#forward)
14-
- [reverse](#reverse)
15-
- [set_direction](#set_direction)
16-
- [get_fault](#get_fault)
17-
- [clear_fault](#get_fault)
18-
19-
20-
## Getting Started
21-
22-
Most people should grab the library from GitHub and run our simple installer:
23-
24-
### Installing
25-
26-
```
27-
git clone https://github.com/pimoroni/drv8830-python
28-
cd drv8830-python
29-
sudo ./install.sh
30-
```
31-
32-
This ensures any dependencies are installed and will copy examples into `~/Pimoroni/drv8830/`
33-
34-
You can install just the drv8830 library by running:
35-
36-
```
37-
sudo pip3 install drv8830
38-
```
39-
40-
## Examples
41-
42-
### Two Motors
43-
[two-motors.py](examples/two-motors.py)
44-
45-
Demonstrates the use of two DRV8830 drivers as part of a two-wheeled robot.
46-
47-
48-
## Function Reference
49-
50-
In all cases you'll first need to initialise a DRV8830 library instance with the specific I2C address for each driver you're using.
51-
52-
```python
53-
from drv8830 import DRV8830, I2C_ADDR1
54-
55-
drv8830 = DRV8830(i2c_addr=I2C_ADDR1)
56-
```
57-
58-
The value that you use for `i2c_addr` will vary depending on your I2C address jumper configuration:
59-
60-
* `I2C_ADDR1` - `0x60` - both select jumpers bridged (not cut) (default)
61-
* `I2C_ADDR2` - `0x61` - only jumper A0 cut (ADDR+1)
62-
* `I2C_ADDR3` - `0x63` - only jumper A1 cut (ADDR+3)
63-
* `I2C_ADDR4` - `0x64` - both A0 and A1 cut (ADDR+1 and ADDR+3)
64-
65-
Ensure care when cutting jumpers, use the point of a sharp hobby-knife and avoid slipping since this may damage other traces.
66-
67-
### set_voltage
68-
69-
```python
70-
drv8830.set_voltage(voltage)
71-
```
72-
73-
Set the motor driver voltage.
74-
75-
Roughly corresponds to motor speed depending upon the characteristics of your motor.
76-
77-
Value values range from 0.48v to 5.06v
78-
79-
### get_voltage
80-
81-
```python
82-
voltage = drv8830.get_voltage()
83-
```
84-
85-
Returns the currently set voltage value from the DRV8830.
86-
87-
### set_outputs
88-
89-
```python
90-
drv8830.set_outputs(out1, out2)
91-
```
92-
93-
Set the individual driver outputs. Eg:
94-
95-
```python
96-
drv8830.set_outputs(1, 0)
97-
```
98-
99-
Possible values are 1 (on) and 0 (off) with the following valid permutations:
100-
101-
* 1 1 - brake
102-
* 0 0 - coast
103-
* 1 0 - forward
104-
* 0 1 - reverse
105-
106-
### brake
107-
108-
```python
109-
drv8830.brake()
110-
```
111-
112-
Drives both outputs high, effectively braking the motor.
113-
114-
Does the same as `drv8830.set_outputs(1, 1)` or `drv8830.set_direction("brake")`.
115-
116-
### coast
117-
118-
```python
119-
drv8830.coast()
120-
```
121-
122-
Drives both outputs low, allowing the motor to coast to a stop.
123-
124-
Does the same as `drv8830.set_outputs(0, 0)` or `drv8830.set_direction("coast")`.
125-
126-
### forward
127-
128-
```python
129-
drv8830.forward()
130-
```
131-
132-
Drives one output high and the other low, effectively turning the motor "forwards" (albeit this depends on how your motor is positioned and wired)
133-
134-
Does the same as `drv8830.set_outputs(1, 0)` or `drv8830.set_direction("forward")`.
135-
136-
### reverse
137-
138-
```python
139-
drv8830.forward()
140-
```
141-
142-
Drives one output high and the other low, effectively turning the motor in "reverse" (albeit this depends on how your motor is positioned and wired)
143-
144-
Does the same as `drv8830.set_outputs(0, 1)` or `drv8830.set_direction("reverse")`.
145-
146-
### set_direction
147-
148-
```python
149-
drv8830.set_direction(direction)
150-
```
151-
152-
Accepts a string and sets the direction to the supplied "forward", "backward", "brake" or "coast".
153-
154-
### get_fault
155-
156-
```python
157-
fault = drv8830.get_fault()
158-
```
159-
160-
Returns a namedtuple of the fault flags:
161-
162-
* `current_limit` - external current limit exceeded (ilimit resistor), must clear fault or disable motor to reactivate
163-
* `over_temperature` - driver has overheated, device resumes once temperature has dropped
164-
* `under_voltage` - driver is below operating voltage (brownout), resumes once voltage has stabalised
165-
* `over_current` - over-current protection activated, device disabled, must clear fault to reactivate
166-
* `fault` - one or more fault flags is set
167-
168-
### clear_fault
169-
170-
```python
171-
drv8830.clear_fault()
172-
```
173-
174-
Clear any outstanding fault conditions.
1+
# Reference <!-- omit in toc -->
2+
3+
- [Getting Started](#getting-started)
4+
- [Installing](#installing)
5+
- [Examples](#examples)
6+
- [Two Motors](#two-motors)
7+
- [Function Reference](#function-reference)
8+
- [set_voltage](#set_voltage)
9+
- [get_voltage](#get_voltage)
10+
- [set_outputs](#set_outputs)
11+
- [brake](#brake)
12+
- [coast](#coast)
13+
- [forward](#forward)
14+
- [reverse](#reverse)
15+
- [set_direction](#set_direction)
16+
- [get_fault](#get_fault)
17+
- [clear_fault](#get_fault)
18+
19+
20+
## Getting Started
21+
22+
Most people should grab the library from GitHub and run our simple installer:
23+
24+
### Installing
25+
26+
```
27+
git clone https://github.com/pimoroni/drv8830-python
28+
cd drv8830-python
29+
sudo ./install.sh
30+
```
31+
32+
This ensures any dependencies are installed and will copy examples into `~/Pimoroni/drv8830/`
33+
34+
You can install just the drv8830 library by running:
35+
36+
```
37+
sudo pip3 install drv8830
38+
```
39+
40+
## Examples
41+
42+
### Two Motors
43+
[two-motors.py](examples/two-motors.py)
44+
45+
Demonstrates the use of two DRV8830 drivers as part of a two-wheeled robot.
46+
47+
48+
## Function Reference
49+
50+
In all cases you'll first need to initialise a DRV8830 library instance with the specific I2C address for each driver you're using.
51+
52+
```python
53+
from drv8830 import DRV8830, I2C_ADDR1
54+
55+
drv8830 = DRV8830(i2c_addr=I2C_ADDR1)
56+
```
57+
58+
The value that you use for `i2c_addr` will vary depending on your I2C address jumper configuration:
59+
60+
* `I2C_ADDR1` - `0x60` - both select jumpers bridged (not cut) (default)
61+
* `I2C_ADDR2` - `0x61` - only jumper A0 cut (ADDR+1)
62+
* `I2C_ADDR3` - `0x63` - only jumper A1 cut (ADDR+3)
63+
* `I2C_ADDR4` - `0x64` - both A0 and A1 cut (ADDR+1 and ADDR+3)
64+
65+
Ensure care when cutting jumpers, use the point of a sharp hobby-knife and avoid slipping since this may damage other traces.
66+
67+
### set_voltage
68+
69+
```python
70+
drv8830.set_voltage(voltage)
71+
```
72+
73+
Set the motor driver voltage.
74+
75+
Roughly corresponds to motor speed depending upon the characteristics of your motor.
76+
77+
Value values range from 0.48v to 5.06v
78+
79+
### get_voltage
80+
81+
```python
82+
voltage = drv8830.get_voltage()
83+
```
84+
85+
Returns the currently set voltage value from the DRV8830.
86+
87+
### set_outputs
88+
89+
```python
90+
drv8830.set_outputs(out1, out2)
91+
```
92+
93+
Set the individual driver outputs. Eg:
94+
95+
```python
96+
drv8830.set_outputs(1, 0)
97+
```
98+
99+
Possible values are 1 (on) and 0 (off) with the following valid permutations:
100+
101+
* 1 1 - brake
102+
* 0 0 - coast
103+
* 1 0 - forward
104+
* 0 1 - reverse
105+
106+
### brake
107+
108+
```python
109+
drv8830.brake()
110+
```
111+
112+
Drives both outputs high, effectively braking the motor.
113+
114+
Does the same as `drv8830.set_outputs(1, 1)` or `drv8830.set_direction("brake")`.
115+
116+
### coast
117+
118+
```python
119+
drv8830.coast()
120+
```
121+
122+
Drives both outputs low, allowing the motor to coast to a stop.
123+
124+
Does the same as `drv8830.set_outputs(0, 0)` or `drv8830.set_direction("coast")`.
125+
126+
### forward
127+
128+
```python
129+
drv8830.forward()
130+
```
131+
132+
Drives one output high and the other low, effectively turning the motor "forwards" (albeit this depends on how your motor is positioned and wired)
133+
134+
Does the same as `drv8830.set_outputs(1, 0)` or `drv8830.set_direction("forward")`.
135+
136+
### reverse
137+
138+
```python
139+
drv8830.forward()
140+
```
141+
142+
Drives one output high and the other low, effectively turning the motor in "reverse" (albeit this depends on how your motor is positioned and wired)
143+
144+
Does the same as `drv8830.set_outputs(0, 1)` or `drv8830.set_direction("reverse")`.
145+
146+
### set_direction
147+
148+
```python
149+
drv8830.set_direction(direction)
150+
```
151+
152+
Accepts a string and sets the direction to the supplied "forward", "backward", "brake" or "coast".
153+
154+
### get_fault
155+
156+
```python
157+
fault = drv8830.get_fault()
158+
```
159+
160+
Returns a namedtuple of the fault flags:
161+
162+
* `current_limit` - external current limit exceeded (ilimit resistor), must clear fault or disable motor to reactivate
163+
* `over_temperature` - driver has overheated, device resumes once temperature has dropped
164+
* `under_voltage` - driver is below operating voltage (brownout), resumes once voltage has stabalised
165+
* `over_current` - over-current protection activated, device disabled, must clear fault to reactivate
166+
* `fault` - one or more fault flags is set
167+
168+
### clear_fault
169+
170+
```python
171+
drv8830.clear_fault()
172+
```
173+
174+
Clear any outstanding fault conditions.

tests/conftest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import pytest
2-
from i2cdevice import MockSMBus
3-
4-
5-
@pytest.fixture(scope='function', autouse=False)
6-
def i2c_dev():
7-
yield MockSMBus(1)
1+
import pytest
2+
from i2cdevice import MockSMBus
3+
4+
5+
@pytest.fixture(scope='function', autouse=False)
6+
def i2c_dev():
7+
yield MockSMBus(1)

0 commit comments

Comments
 (0)