litex/misoclib/tools/litescope/example_designs/test/test_io.py

38 lines
768 B
Python
Raw Normal View History

2015-01-22 18:08:04 -05:00
import time
from misoclib.tools.litescope.host.driver.io import LiteScopeIODriver
2015-01-22 18:08:04 -05:00
2015-04-13 07:18:21 -04:00
2015-01-22 18:08:04 -05:00
def led_anim0(io):
for i in range(10):
io.write(0xA5)
time.sleep(0.1)
io.write(0x5A)
time.sleep(0.1)
2015-01-22 18:08:04 -05:00
2015-04-13 07:18:21 -04:00
2015-01-22 18:08:04 -05:00
def led_anim1(io):
for j in range(4):
#Led <<
led_data = 1
for i in range(8):
io.write(led_data)
time.sleep(i*i*0.0020)
led_data = (led_data<<1)
#Led >>
ledData = 128
for i in range(8):
io.write(led_data)
time.sleep(i*i*0.0020)
led_data = (led_data>>1)
2015-01-22 18:08:04 -05:00
2015-04-13 07:18:21 -04:00
def main(wb):
io = LiteScopeIODriver(wb.regs, "io")
wb.open()
###
led_anim0(io)
led_anim1(io)
print("%02X" %io.read())
###
wb.close()