summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDavid P <dpoirier@y7mail.com>2021-06-12 14:53:44 +1000
committerDamien George <damien@micropython.org>2021-07-18 11:23:41 +1000
commitf365025c9c699a4a42c103b9ff01071ebc8d57c8 (patch)
treecc36bc6703e39729274141541b00cf3f3747caca /tests
parentfdd5b18133e9d9f5a4e76be22ece6632d11d7fee (diff)
downloadmicropython-f365025c9c699a4a42c103b9ff01071ebc8d57c8.tar.gz
micropython-f365025c9c699a4a42c103b9ff01071ebc8d57c8.zip
stm32: Replace master/slave with controller/peripheral in I2C and SPI.
Replace "master" with "controller" and "slave" with "peripheral" in comments, errors, and debug messages. Add CONTROLLER and PERIPHERAL constants to pyb.SPI and pyb.I2C classes; retain MASTER and SLAVE constants for backward compatiblity.
Diffstat (limited to 'tests')
-rw-r--r--tests/pyb/i2c.py2
-rw-r--r--tests/pyb/i2c_accel.py2
-rw-r--r--tests/pyb/i2c_error.py2
-rw-r--r--tests/pyb/pyb_f405.py2
-rw-r--r--tests/pyb/spi.py14
-rw-r--r--tests/pyb/spi.py.exp4
6 files changed, 14 insertions, 12 deletions
diff --git a/tests/pyb/i2c.py b/tests/pyb/i2c.py
index bc9dba8781..c968843273 100644
--- a/tests/pyb/i2c.py
+++ b/tests/pyb/i2c.py
@@ -11,6 +11,6 @@ for bus in (-1, 0, 1):
i2c = I2C(1)
-i2c.init(I2C.MASTER, baudrate=400000)
+i2c.init(I2C.CONTROLLER, baudrate=400000)
print(i2c.scan())
i2c.deinit()
diff --git a/tests/pyb/i2c_accel.py b/tests/pyb/i2c_accel.py
index 8c74fa60e6..8b87d406d0 100644
--- a/tests/pyb/i2c_accel.py
+++ b/tests/pyb/i2c_accel.py
@@ -11,7 +11,7 @@ accel_addr = 76
pyb.Accel() # this will init the MMA for us
-i2c = I2C(1, I2C.MASTER, baudrate=400000)
+i2c = I2C(1, I2C.CONTROLLER, baudrate=400000)
print(i2c.scan())
print(i2c.is_ready(accel_addr))
diff --git a/tests/pyb/i2c_error.py b/tests/pyb/i2c_error.py
index b17a26325d..1228962f5f 100644
--- a/tests/pyb/i2c_error.py
+++ b/tests/pyb/i2c_error.py
@@ -11,7 +11,7 @@ if not hasattr(pyb, "Accel"):
pyb.Accel()
# get I2C bus
-i2c = I2C(1, I2C.MASTER, dma=True)
+i2c = I2C(1, I2C.CONTROLLER, dma=True)
# test polling mem_read
pyb.disable_irq()
diff --git a/tests/pyb/pyb_f405.py b/tests/pyb/pyb_f405.py
index 243381056e..d7431a11a1 100644
--- a/tests/pyb/pyb_f405.py
+++ b/tests/pyb/pyb_f405.py
@@ -10,7 +10,7 @@ print(pyb.freq())
print(type(pyb.rng()))
# test HAL error specific to F405
-i2c = pyb.I2C(2, pyb.I2C.MASTER)
+i2c = pyb.I2C(2, pyb.I2C.CONTROLLER)
try:
i2c.recv(1, 1)
except OSError as e:
diff --git a/tests/pyb/spi.py b/tests/pyb/spi.py
index 73d39e7245..7df6aeb457 100644
--- a/tests/pyb/spi.py
+++ b/tests/pyb/spi.py
@@ -11,12 +11,14 @@ for bus in (-1, 0, 1, 2):
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(str(spi)[:28], str(spi)[49:]) # don't print baudrate/prescaler
+spi = SPI(1, SPI.CONTROLLER)
+spi = SPI(1, SPI.CONTROLLER, baudrate=500000)
+spi = SPI(
+ 1, SPI.CONTROLLER, 500000, polarity=1, phase=0, bits=8, firstbit=SPI.MSB, ti=False, crc=None
+)
+print(str(spi)[:32], str(spi)[53:]) # don't print baudrate/prescaler
-spi.init(SPI.SLAVE, phase=1)
+spi.init(SPI.PERIPHERAL, phase=1)
print(spi)
try:
# need to flush input before we get an error (error is what we want to test)
@@ -25,7 +27,7 @@ try:
except OSError:
print("OSError")
-spi.init(SPI.MASTER)
+spi.init(SPI.CONTROLLER)
spi.send(1, timeout=100)
print(spi.recv(1, timeout=100))
print(spi.send_recv(1, timeout=100))
diff --git a/tests/pyb/spi.py.exp b/tests/pyb/spi.py.exp
index 473c173a58..661bace900 100644
--- a/tests/pyb/spi.py.exp
+++ b/tests/pyb/spi.py.exp
@@ -3,8 +3,8 @@ ValueError 0
SPI 1
SPI 2
SPI(1)
-SPI(1, SPI.MASTER, baudrate= , polarity=1, phase=0, bits=8)
-SPI(1, SPI.SLAVE, polarity=1, phase=1, bits=8)
+SPI(1, SPI.CONTROLLER, baudrate= , polarity=1, phase=0, bits=8)
+SPI(1, SPI.PERIPHERAL, polarity=1, phase=1, bits=8)
OSError
b'\xff'
b'\xff'