Skip to content

Commit

Permalink
Fix line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Sep 23, 2019
1 parent 4b56544 commit d024f0d
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 114 deletions.
60 changes: 30 additions & 30 deletions examples/two-motors.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import time
from drv8830 import DRV8830, I2C_ADDR1, I2C_ADDR2


left = DRV8830(I2C_ADDR1)
right = DRV8830(I2C_ADDR2)

# Move forward
left.forward()
right.forward()
time.sleep(1.0)

# Turn left
left.reverse()
right.forward()
time.sleep(1.0)

# Turn right
left.forward()
right.reverse()
time.sleep(1.0)

# Move backward
left.reverse()
right.reverse()
time.sleep(1.0)

# Coast to a stop
left.coast()
right.coast()
import time
from drv8830 import DRV8830, I2C_ADDR1, I2C_ADDR2


left = DRV8830(I2C_ADDR1)
right = DRV8830(I2C_ADDR2)

# Move forward
left.forward()
right.forward()
time.sleep(1.0)

# Turn left
left.reverse()
right.forward()
time.sleep(1.0)

# Turn right
left.forward()
right.reverse()
time.sleep(1.0)

# Move backward
left.reverse()
right.reverse()
time.sleep(1.0)

# Coast to a stop
left.coast()
right.coast()
time.sleep(1.0)
130 changes: 65 additions & 65 deletions library/tests/test_features.py
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
from i2cdevice import MockSMBus


def test_forward():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.forward()


def test_reverse():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.reverse()


def test_brake():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.brake()


def test_coast():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.coast()


def test_set_outputs():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.set_outputs(out1=0, out2=0)


def test_set_voltage():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.set_voltage(5.06)
assert drv8830.get_voltage() == 5.06


def test_set_voltage_snap():
# Should snap to the nearest available voltage and read back correctly
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.set_voltage(0.82)
assert drv8830.get_voltage() == 0.80


def test_voltage_out_of_range():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.set_voltage(0)
assert drv8830.get_voltage() == 0


def test_get_fault():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
assert drv8830.get_fault().current_limit == 0


def test_clear_fault():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.clear_fault()
from i2cdevice import MockSMBus


def test_forward():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.forward()


def test_reverse():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.reverse()


def test_brake():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.brake()


def test_coast():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.coast()


def test_set_outputs():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.set_outputs(out1=0, out2=0)


def test_set_voltage():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.set_voltage(5.06)
assert drv8830.get_voltage() == 5.06


def test_set_voltage_snap():
# Should snap to the nearest available voltage and read back correctly
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.set_voltage(0.82)
assert drv8830.get_voltage() == 0.80


def test_voltage_out_of_range():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.set_voltage(0)
assert drv8830.get_voltage() == 0


def test_get_fault():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
assert drv8830.get_fault().current_limit == 0


def test_clear_fault():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.clear_fault()
38 changes: 19 additions & 19 deletions library/tests/test_setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from i2cdevice import MockSMBus


def test_setup():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
del drv8830


def test_setup_alt_addr2():
from drv8830 import DRV8830, I2C_ADDR2
drv8830 = DRV8830(i2c_dev=MockSMBus(1), i2c_addr=I2C_ADDR2)
del drv8830


def test_setup_alt_addr3():
from drv8830 import DRV8830, I2C_ADDR3
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.select_i2c_address(I2C_ADDR3)
from i2cdevice import MockSMBus


def test_setup():
from drv8830 import DRV8830
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
del drv8830


def test_setup_alt_addr2():
from drv8830 import DRV8830, I2C_ADDR2
drv8830 = DRV8830(i2c_dev=MockSMBus(1), i2c_addr=I2C_ADDR2)
del drv8830


def test_setup_alt_addr3():
from drv8830 import DRV8830, I2C_ADDR3
drv8830 = DRV8830(i2c_dev=MockSMBus(1))
drv8830.select_i2c_address(I2C_ADDR3)

0 comments on commit d024f0d

Please sign in to comment.