diff options
author | David P <dpoirier@y7mail.com> | 2021-06-12 14:53:44 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-07-18 11:23:41 +1000 |
commit | f365025c9c699a4a42c103b9ff01071ebc8d57c8 (patch) | |
tree | cc36bc6703e39729274141541b00cf3f3747caca /tests/pyb/spi.py | |
parent | fdd5b18133e9d9f5a4e76be22ece6632d11d7fee (diff) | |
download | micropython-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/pyb/spi.py')
-rw-r--r-- | tests/pyb/spi.py | 14 |
1 files changed, 8 insertions, 6 deletions
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)) |