summaryrefslogtreecommitdiff
path: root/tests/pyb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pyb')
-rw-r--r--tests/pyb/halerror.py15
-rw-r--r--tests/pyb/i2c.py32
-rw-r--r--tests/pyb/i2c.py.exp12
-rw-r--r--tests/pyb/i2c_error.py50
-rw-r--r--tests/pyb/spi.py33
-rw-r--r--tests/pyb/spi.py.exp14
6 files changed, 0 insertions, 156 deletions
diff --git a/tests/pyb/halerror.py b/tests/pyb/halerror.py
deleted file mode 100644
index 1a6bce1a7..000000000
--- a/tests/pyb/halerror.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# test hal errors
-
-import pyb
-
-i2c = pyb.I2C(2, pyb.I2C.MASTER)
-try:
- i2c.recv(1, 1)
-except OSError as e:
- print(repr(e))
-
-can = pyb.CAN(1, pyb.CAN.NORMAL)
-try:
- can.send('1', 1, timeout=50)
-except OSError as e:
- print(repr(e))
diff --git a/tests/pyb/i2c.py b/tests/pyb/i2c.py
deleted file mode 100644
index 6875e5a5a..000000000
--- a/tests/pyb/i2c.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import pyb
-from pyb import I2C
-
-# test we can correctly create by id or name
-for bus in (-1, 0, 1, 2, 3, "X", "Y", "Z"):
- try:
- I2C(bus)
- print("I2C", bus)
- except ValueError:
- print("ValueError", bus)
-
-i2c = I2C(1)
-
-i2c.init(I2C.MASTER, baudrate=400000)
-print(i2c.scan())
-i2c.deinit()
-
-# use accelerometer to test i2c bus
-
-accel_addr = 76
-
-pyb.Accel() # this will init the MMA for us
-i2c.init(I2C.MASTER, baudrate=400000)
-
-print(i2c.scan())
-print(i2c.is_ready(accel_addr))
-
-print(i2c.mem_read(1, accel_addr, 7, timeout=500))
-i2c.mem_write(0, accel_addr, 0, timeout=500)
-
-i2c.send(7, addr=accel_addr)
-i2c.recv(1, addr=accel_addr)
diff --git a/tests/pyb/i2c.py.exp b/tests/pyb/i2c.py.exp
deleted file mode 100644
index 709fb412d..000000000
--- a/tests/pyb/i2c.py.exp
+++ /dev/null
@@ -1,12 +0,0 @@
-ValueError -1
-ValueError 0
-I2C 1
-I2C 2
-ValueError 3
-I2C X
-I2C Y
-ValueError Z
-[]
-[76]
-True
-b'\x01'
diff --git a/tests/pyb/i2c_error.py b/tests/pyb/i2c_error.py
deleted file mode 100644
index 3201d6367..000000000
--- a/tests/pyb/i2c_error.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# test I2C errors, with polling (disabled irqs) and DMA
-
-import pyb
-from pyb import I2C
-
-# init accelerometer
-pyb.Accel()
-
-# get I2C bus
-i2c = I2C(1, I2C.MASTER, dma=True)
-
-# test polling mem_read
-pyb.disable_irq()
-i2c.mem_read(1, 76, 0x0a) # should succeed
-pyb.enable_irq()
-try:
- pyb.disable_irq()
- i2c.mem_read(1, 77, 0x0a) # should fail
-except OSError as e:
- pyb.enable_irq()
- print(repr(e))
-i2c.mem_read(1, 76, 0x0a) # should succeed
-
-# test polling mem_write
-pyb.disable_irq()
-i2c.mem_write(1, 76, 0x0a) # should succeed
-pyb.enable_irq()
-try:
- pyb.disable_irq()
- i2c.mem_write(1, 77, 0x0a) # should fail
-except OSError as e:
- pyb.enable_irq()
- print(repr(e))
-i2c.mem_write(1, 76, 0x0a) # should succeed
-
-# test DMA mem_read
-i2c.mem_read(1, 76, 0x0a) # should succeed
-try:
- i2c.mem_read(1, 77, 0x0a) # should fail
-except OSError as e:
- print(repr(e))
-i2c.mem_read(1, 76, 0x0a) # should succeed
-
-# test DMA mem_write
-i2c.mem_write(1, 76, 0x0a) # should succeed
-try:
- i2c.mem_write(1, 77, 0x0a) # should fail
-except OSError as e:
- print(repr(e))
-i2c.mem_write(1, 76, 0x0a) # should succeed
diff --git a/tests/pyb/spi.py b/tests/pyb/spi.py
deleted file mode 100644
index 88cc975bb..000000000
--- a/tests/pyb/spi.py
+++ /dev/null
@@ -1,33 +0,0 @@
-from pyb import SPI
-
-# test we can correctly create by id or name
-for bus in (-1, 0, 1, 2, 3, "X", "Y", "Z"):
- try:
- SPI(bus)
- print("SPI", bus)
- except ValueError:
- print("ValueError", bus)
-
-spi = SPI(1)
-print(spi)
-
-spi = SPI(1, SPI.MASTER)
-spi = SPI(1, SPI.MASTER, baudrate=500000)
-spi = SPI(1, SPI.MASTER, 500000, polarity=1, phase=0, bits=8, firstbit=SPI.MSB, ti=False, crc=None)
-print(spi)
-
-spi.init(SPI.SLAVE, phase=1)
-print(spi)
-try:
- # need to flush input before we get an error (error is what we want to test)
- for i in range(10):
- spi.recv(1, timeout=100)
-except OSError:
- print("OSError")
-
-spi.init(SPI.MASTER)
-spi.send(1, timeout=100)
-print(spi.recv(1, timeout=100))
-print(spi.send_recv(1, timeout=100))
-
-spi.deinit()
diff --git a/tests/pyb/spi.py.exp b/tests/pyb/spi.py.exp
deleted file mode 100644
index a0d835700..000000000
--- a/tests/pyb/spi.py.exp
+++ /dev/null
@@ -1,14 +0,0 @@
-ValueError -1
-ValueError 0
-SPI 1
-SPI 2
-ValueError 3
-SPI X
-SPI Y
-ValueError Z
-SPI(1)
-SPI(1, SPI.MASTER, baudrate=328125, prescaler=256, polarity=1, phase=0, bits=8)
-SPI(1, SPI.SLAVE, polarity=1, phase=1, bits=8)
-OSError
-b'\xff'
-b'\xff'