README: Remove a statement that's not particularly true at the moment

This commit is contained in:
Jeff Epler 2020-06-14 16:58:08 -05:00 committed by Jeff Epler
parent 3c11f6cc05
commit d82292fa1f
9 changed files with 0 additions and 518 deletions

View File

@ -96,7 +96,6 @@ CircuitPython:
- Supports native USB on all boards, allowing file editing without special tools.
- Supports only SAMD21, SAMD51, nRF52840, CXD56, STM32F4 and i.MX RT ports.
- Tracks MicroPython's releases (not master).
- Floats (aka decimals) are enabled for all builds.
- Error messages are translated into 10+ languages.
- Does not support concurrency within Python (including interrupts and threading). Some concurrency

View File

@ -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))

View File

@ -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)

View File

@ -1,12 +0,0 @@
ValueError -1
ValueError 0
I2C 1
I2C 2
ValueError 3
I2C X
I2C Y
ValueError Z
[]
[76]
True
b'\x01'

View File

@ -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

View File

@ -1,175 +0,0 @@
'''
I2C test for the CC3200 based boards.
A MPU-9150 sensor must be connected to the I2C bus.
'''
from machine import I2C
import os
import time
mch = os.uname().machine
if 'LaunchPad' in mch:
i2c_pins = ('GP11', 'GP10')
elif 'WiPy' in mch:
i2c_pins = ('GP15', 'GP10')
else:
raise Exception('Board not supported!')
i2c = I2C(0, I2C.MASTER, baudrate=400000)
# try initing without the peripheral id
i2c = I2C()
print(i2c)
i2c = I2C(mode=I2C.MASTER, baudrate=50000, pins=i2c_pins)
print(i2c)
i2c = I2C(0, I2C.MASTER, baudrate=100000)
print(i2c)
i2c = I2C(0, mode=I2C.MASTER, baudrate=400000)
print(i2c)
i2c = I2C(0, mode=I2C.MASTER, baudrate=400000, pins=i2c_pins)
print(i2c)
addr = i2c.scan()[0]
print(addr)
reg = bytearray(1)
reg2 = bytearray(2)
reg2_r = bytearray(2)
# reset the sensor
reg[0] |= 0x80
print(1 == i2c.writeto_mem(addr, 107, reg))
time.sleep_ms(100) # wait for the sensor to reset...
print(1 == i2c.readfrom_mem_into(addr, 107, reg)) # read the power management register 1
print(0x40 == reg[0])
# now just read one byte
data = i2c.readfrom_mem(addr, 117, 1) # read the "who am I?" register
print(0x68 == data[0])
print(len(data) == 1)
print(1 == i2c.readfrom_mem_into(addr, 117, reg)) # read the "who am I?" register again
print(0x68 == reg[0])
# now try reading two bytes
data = i2c.readfrom_mem(addr, 116, 2) # read the "who am I?" register
print(0x68 == data[1])
print(data == b'\x00\x68')
print(len(data) == 2)
print(2 == i2c.readfrom_mem_into(addr, 116, reg2)) # read the "who am I?" register again
print(0x68 == reg2[1])
print(reg2 == b'\x00\x68')
print(1 == i2c.readfrom_mem_into(addr, 107, reg)) # read the power management register 1
print(0x40 == reg[0])
# clear the sleep bit
reg[0] = 0
print(1 == i2c.writeto_mem(addr, 107, reg))
# read it back
i2c.readfrom_mem_into(addr, 107, reg)
print(0 == reg[0])
# set the sleep bit
reg[0] = 0x40
print(1 == i2c.writeto_mem(addr, 107, reg))
# read it back
i2c.readfrom_mem_into(addr, 107, reg)
print(0x40 == reg[0])
# reset the sensor
reg[0] |= 0x80
print(1 == i2c.writeto_mem(addr, 107, reg))
time.sleep_ms(100) # wait for the sensor to reset...
# now read and write two register at a time
print(2 == i2c.readfrom_mem_into(addr, 107, reg2))
print(0x40 == reg2[0])
print(0x00 == reg2[1])
# clear the sleep bit
reg2[0] = 0
# set some other bits
reg2[1] |= 0x03
print(2 == i2c.writeto_mem(addr, 107, reg2))
# read it back
i2c.readfrom_mem_into(addr, 107, reg2_r)
print(reg2 == reg2_r)
# reset the sensor
reg[0] = 0x80
print(1 == i2c.writeto_mem(addr, 107, reg))
time.sleep_ms(100) # wait for the sensor to reset...
# try some raw read and writes
reg[0] = 117 # register address
print(1 == i2c.writeto(addr, reg, stop=False)) # just write the register address
# now read
print(1 == i2c.readfrom_into(addr, reg))
print(reg[0] == 0x68)
reg[0] = 117 # register address
print(1 == i2c.writeto(addr, reg, stop=False)) # just write the register address
# now read
print(0x68 == i2c.readfrom(addr, 1)[0])
i2c.readfrom_mem_into(addr, 107, reg2)
print(0x40 == reg2[0])
print(0x00 == reg2[1])
reg2[0] = 107 # register address
reg2[1] = 0
print(2 == i2c.writeto(addr, reg2, stop=True)) # write the register address and the data
i2c.readfrom_mem_into(addr, 107, reg) # check it back
print(reg[0] == 0)
# check for memory leaks...
for i in range (0, 1000):
i2c = I2C(0, I2C.MASTER, baudrate=100000)
# test deinit
i2c = I2C(0, I2C.MASTER, baudrate=100000)
i2c.deinit()
print(i2c)
# next ones should raise
try:
i2c.scan()
except Exception:
print("Exception")
try:
i2c.readfrom(addr, 1)
except Exception:
print("Exception")
try:
i2c.readfrom_into(addr, reg)
except Exception:
print("Exception")
try:
i2c.readfrom_mem_into(addr, 107, reg)
except Exception:
print("Exception")
try:
i2c.writeto(addr, reg, stop=False)
except Exception:
print("Exception")
try:
i2c.writeto_mem(addr, 107, reg)
except Exception:
print("Exception")
try:
i2c.readfrom_mem(addr, 116, 2)
except Exception:
print("Exception")
try:
I2C(1, I2C.MASTER, baudrate=100000)
except Exception:
print("Exception")
# reinitialization must work
i2c.init(baudrate=400000)
print(i2c)

View File

@ -1,51 +0,0 @@
I2C(0, I2C.MASTER, baudrate=100000)
I2C(0, I2C.MASTER, baudrate=50000)
I2C(0, I2C.MASTER, baudrate=100000)
I2C(0, I2C.MASTER, baudrate=400000)
I2C(0, I2C.MASTER, baudrate=400000)
104
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
I2C(0)
Exception
Exception
Exception
Exception
Exception
Exception
Exception
Exception
I2C(0, I2C.MASTER, baudrate=400000)

View File

@ -1,147 +0,0 @@
'''
SPI test for the CC3200 based boards.
'''
from machine import SPI
import os
mch = os.uname().machine
if 'LaunchPad' in mch:
spi_pins = ('GP14', 'GP16', 'GP30')
elif 'WiPy' in mch:
spi_pins = ('GP14', 'GP16', 'GP30')
else:
raise Exception('Board not supported!')
spi = SPI(0, SPI.MASTER, baudrate=2000000, polarity=0, phase=0, firstbit=SPI.MSB, pins=spi_pins)
print(spi)
spi = SPI(baudrate=5000000)
print(spi)
spi = SPI(0, SPI.MASTER, baudrate=200000, bits=16, polarity=0, phase=0)
print(spi)
spi = SPI(0, SPI.MASTER, baudrate=10000000, polarity=0, phase=1)
print(spi)
spi = SPI(0, SPI.MASTER, baudrate=5000000, bits=32, polarity=1, phase=0)
print(spi)
spi = SPI(0, SPI.MASTER, baudrate=10000000, polarity=1, phase=1)
print(spi)
spi.init(baudrate=20000000, polarity=0, phase=0)
print(spi)
spi=SPI()
print(spi)
SPI(mode=SPI.MASTER)
SPI(mode=SPI.MASTER, pins=spi_pins)
SPI(id=0, mode=SPI.MASTER, polarity=0, phase=0, pins=('GP14', 'GP16', 'GP15'))
SPI(0, SPI.MASTER, polarity=0, phase=0, pins=('GP31', 'GP16', 'GP15'))
spi = SPI(0, SPI.MASTER, baudrate=10000000, polarity=0, phase=0, pins=spi_pins)
print(spi.write('123456') == 6)
buffer_r = bytearray(10)
print(spi.readinto(buffer_r) == 10)
print(spi.readinto(buffer_r, write=0x55) == 10)
read = spi.read(10)
print(len(read) == 10)
read = spi.read(10, write=0xFF)
print(len(read) == 10)
buffer_w = bytearray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
print(spi.write_readinto(buffer_w, buffer_r) == 10)
print(buffer_w == buffer_r)
# test all polaritiy and phase combinations
spi.init(polarity=1, phase=0, pins=None)
buffer_r = bytearray(10)
spi.write_readinto(buffer_w, buffer_r)
print(buffer_w == buffer_r)
spi.init(polarity=1, phase=1, pins=None)
buffer_r = bytearray(10)
spi.write_readinto(buffer_w, buffer_r)
print(buffer_w == buffer_r)
spi.init(polarity=0, phase=1, pins=None)
buffer_r = bytearray(10)
spi.write_readinto(buffer_w, buffer_r)
print(buffer_w == buffer_r)
# test 16 and 32 bit transfers
buffer_w = bytearray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2])
buffer_r = bytearray(12)
spi.init(SPI.MASTER, baudrate=10000000, bits=16, polarity=0, phase=0, pins=None)
print(spi.write_readinto(buffer_w, buffer_r) == 12)
print(buffer_w == buffer_r)
buffer_r = bytearray(12)
spi.init(SPI.MASTER, baudrate=10000000, bits=32, polarity=0, phase=0, pins=None)
print(spi.write_readinto(buffer_w, buffer_r) == 12)
print(buffer_w == buffer_r)
# check for memory leaks...
for i in range (0, 1000):
spi = SPI(0, SPI.MASTER, baudrate=1000000)
# test deinit
spi = SPI(0, SPI.MASTER, baudrate=1000000)
spi.deinit()
print(spi)
spi = SPI(0, SPI.MASTER, baudrate=1000000)
# next ones must fail
try:
spi = SPI(0, 10, baudrate=10000000, polarity=0, phase=0)
except:
print("Exception")
try:
spi = SPI(0, mode=SPI.MASTER, baudrate=10000000, polarity=1, phase=2)
except:
print("Exception")
try:
spi = SPI(1, mode=SPI.MASTER, baudrate=10000000, polarity=1, phase=1)
except:
print("Exception")
try:
spi = SPI(0, mode=SPI.MASTER, baudrate=2000000, polarity=2, phase=0)
except:
print("Exception")
try:
spi = SPI(0, mode=SPI.MASTER, baudrate=2000000, polarity=2, phase=0, firstbit=2)
except:
print("Exception")
try:
spi = SPI(0, mode=SPI.MASTER, baudrate=2000000, polarity=2, phase=0, pins=('GP1', 'GP2'))
except:
print("Exception")
try:
spi = SPI(0, mode=SPI.MASTER, baudrate=2000000, polarity=0, phase=0, bits=9)
except:
print("Exception")
spi.deinit()
try:
spi.read(15)
except Exception:
print("Exception")
try:
spi.spi.readinto(buffer_r)
except Exception:
print("Exception")
try:
spi.spi.write('abc')
except Exception:
print("Exception")
try:
spi.write_readinto(buffer_w, buffer_r)
except Exception:
print("Exception")
# reinitialization must work
spi.init(baudrate=500000)
print(spi)

View File

@ -1,35 +0,0 @@
SPI(0, SPI.MASTER, baudrate=2000000, bits=8, polarity=0, phase=0, firstbit=SPI.MSB)
SPI(0, SPI.MASTER, baudrate=5000000, bits=8, polarity=0, phase=0, firstbit=SPI.MSB)
SPI(0, SPI.MASTER, baudrate=200000, bits=16, polarity=0, phase=0, firstbit=SPI.MSB)
SPI(0, SPI.MASTER, baudrate=10000000, bits=8, polarity=0, phase=1, firstbit=SPI.MSB)
SPI(0, SPI.MASTER, baudrate=5000000, bits=32, polarity=1, phase=0, firstbit=SPI.MSB)
SPI(0, SPI.MASTER, baudrate=10000000, bits=8, polarity=1, phase=1, firstbit=SPI.MSB)
SPI(0, SPI.MASTER, baudrate=20000000, bits=8, polarity=0, phase=0, firstbit=SPI.MSB)
SPI(0, SPI.MASTER, baudrate=1000000, bits=8, polarity=0, phase=0, firstbit=SPI.MSB)
True
True
True
True
True
True
True
True
True
True
True
True
True
True
SPI(0)
Exception
Exception
Exception
Exception
Exception
Exception
Exception
Exception
Exception
Exception
Exception
SPI(0, SPI.MASTER, baudrate=500000, bits=8, polarity=0, phase=0, firstbit=SPI.MSB)