2013-02-26 17:20:29 -05:00
|
|
|
from miscope import trigger, recorder, miIo
|
|
|
|
from miscope.bridges.spi2csr.tools.uart2Spi import *
|
2012-09-13 07:18:03 -04:00
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# P A R A M E T E R S
|
|
|
|
#==============================================================================
|
|
|
|
# Bus Width
|
|
|
|
trig_width = 16
|
|
|
|
dat_width = 16
|
|
|
|
|
|
|
|
# Record Size
|
|
|
|
record_size = 1024
|
|
|
|
|
2012-09-16 05:49:16 -04:00
|
|
|
csr = Uart2Spi(1,115200)
|
|
|
|
|
2012-09-13 07:18:03 -04:00
|
|
|
# Csr Addr
|
2013-02-26 17:14:09 -05:00
|
|
|
MIIO_ADDR = 0x0000
|
2012-09-13 07:18:03 -04:00
|
|
|
|
2013-02-26 17:14:09 -05:00
|
|
|
# Miscope Configuration
|
|
|
|
# miIo
|
|
|
|
miIo0 = miIo.MiIo(MIIO_ADDR, 8, "IO", csr)
|
2012-09-13 07:18:03 -04:00
|
|
|
|
2012-09-16 05:49:16 -04:00
|
|
|
def led_anim0():
|
|
|
|
for i in range(10):
|
2013-02-26 17:14:09 -05:00
|
|
|
miIo0.write(0xA5)
|
2012-09-16 05:49:16 -04:00
|
|
|
time.sleep(0.1)
|
2013-02-26 17:14:09 -05:00
|
|
|
miIo0.write(0x5A)
|
2012-09-16 05:49:16 -04:00
|
|
|
time.sleep(0.1)
|
2012-09-13 07:18:03 -04:00
|
|
|
|
2012-09-16 05:49:16 -04:00
|
|
|
def led_anim1():
|
|
|
|
#Led <<
|
|
|
|
for j in range(4):
|
|
|
|
ledData = 1
|
|
|
|
for i in range(8):
|
2013-02-26 17:14:09 -05:00
|
|
|
miIo0.write(ledData)
|
2012-09-16 05:49:16 -04:00
|
|
|
time.sleep(i*i*0.0020)
|
|
|
|
ledData = (ledData<<1)
|
|
|
|
#Led >>
|
|
|
|
ledData = 128
|
|
|
|
for i in range(8):
|
2013-02-26 17:14:09 -05:00
|
|
|
miIo0.write(ledData)
|
2012-09-16 05:49:16 -04:00
|
|
|
time.sleep(i*i*0.0020)
|
|
|
|
ledData = (ledData>>1)
|
2012-09-13 07:18:03 -04:00
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# T E S T M I G I O
|
|
|
|
#==============================================================================
|
|
|
|
|
2012-09-16 05:49:16 -04:00
|
|
|
print("- Small Led Animation...")
|
|
|
|
led_anim0()
|
|
|
|
time.sleep(1)
|
|
|
|
led_anim1()
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
print("- Read Switch: ",end=' ')
|
2013-02-26 17:14:09 -05:00
|
|
|
print(miIo0.read())
|
2012-09-16 05:49:16 -04:00
|
|
|
|
2012-09-13 07:18:03 -04:00
|
|
|
|