2018-05-28 17:12:47 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2019-06-24 04:04:55 -04:00
|
|
|
# This file is Copyright (c) 2015-2018 Florent Kermarrec <florent@enjoy-digital.fr>
|
|
|
|
# License: BSD
|
|
|
|
|
2015-09-07 05:49:54 -04:00
|
|
|
import time
|
2018-05-28 17:12:47 -04:00
|
|
|
|
2018-09-23 04:36:19 -04:00
|
|
|
from litex import RemoteClient
|
2015-09-07 05:49:54 -04:00
|
|
|
|
2018-05-28 17:12:47 -04:00
|
|
|
from litescope import LiteScopeIODriver
|
|
|
|
|
|
|
|
wb = RemoteClient()
|
|
|
|
wb.open()
|
|
|
|
|
|
|
|
# # #
|
2015-09-07 05:49:54 -04:00
|
|
|
|
2015-09-27 12:47:30 -04:00
|
|
|
def led_anim0(inout):
|
2015-09-07 05:49:54 -04:00
|
|
|
for i in range(10):
|
2016-03-31 05:37:00 -04:00
|
|
|
io.write(0xa5)
|
2015-09-07 05:49:54 -04:00
|
|
|
time.sleep(0.1)
|
2016-03-31 05:37:00 -04:00
|
|
|
io.write(0x5a)
|
2015-09-07 05:49:54 -04:00
|
|
|
time.sleep(0.1)
|
|
|
|
|
2015-09-27 12:47:30 -04:00
|
|
|
def led_anim1(inout):
|
2015-09-07 05:49:54 -04:00
|
|
|
for j in range(4):
|
|
|
|
# Led <<
|
|
|
|
led_data = 1
|
|
|
|
for i in range(8):
|
2016-03-31 05:37:00 -04:00
|
|
|
io.write(led_data)
|
2015-09-07 05:49:54 -04:00
|
|
|
time.sleep(i*i*0.0020)
|
|
|
|
led_data = (led_data << 1)
|
|
|
|
# Led >>
|
|
|
|
ledData = 128
|
|
|
|
for i in range(8):
|
2016-03-31 05:37:00 -04:00
|
|
|
io.write(led_data)
|
2015-09-07 05:49:54 -04:00
|
|
|
time.sleep(i*i*0.0020)
|
|
|
|
led_data = (led_data >> 1)
|
|
|
|
|
2016-03-31 05:37:00 -04:00
|
|
|
io = LiteScopeIODriver(wb.regs, "io")
|
2015-11-16 18:23:51 -05:00
|
|
|
|
2016-03-31 05:37:00 -04:00
|
|
|
led_anim0(io)
|
|
|
|
led_anim1(io)
|
|
|
|
print("{:02x}".format(io.read()))
|
2015-11-16 18:23:51 -05:00
|
|
|
|
|
|
|
# # #
|
|
|
|
|
|
|
|
wb.close()
|