2015-01-22 18:08:04 -05:00
|
|
|
import time
|
2015-05-01 14:27:31 -04:00
|
|
|
from misoclib.tools.litescope.software.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):
|
2015-04-13 07:09:44 -04:00
|
|
|
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):
|
2015-04-13 07:09:44 -04:00
|
|
|
for j in range(4):
|
2015-04-13 07:46:06 -04:00
|
|
|
# Led <<
|
2015-04-13 07:09:44 -04:00
|
|
|
led_data = 1
|
|
|
|
for i in range(8):
|
|
|
|
io.write(led_data)
|
|
|
|
time.sleep(i*i*0.0020)
|
2015-04-13 07:56:24 -04:00
|
|
|
led_data = (led_data << 1)
|
2015-04-13 07:46:06 -04:00
|
|
|
# Led >>
|
2015-04-13 07:09:44 -04:00
|
|
|
ledData = 128
|
|
|
|
for i in range(8):
|
|
|
|
io.write(led_data)
|
|
|
|
time.sleep(i*i*0.0020)
|
2015-04-13 07:56:24 -04:00
|
|
|
led_data = (led_data >> 1)
|
2015-01-22 18:08:04 -05:00
|
|
|
|
2015-04-13 07:18:21 -04:00
|
|
|
|
2015-02-23 12:55:19 -05:00
|
|
|
def main(wb):
|
2015-04-13 07:09:44 -04:00
|
|
|
io = LiteScopeIODriver(wb.regs, "io")
|
|
|
|
wb.open()
|
2015-04-13 07:46:06 -04:00
|
|
|
# # #
|
2015-04-13 07:09:44 -04:00
|
|
|
led_anim0(io)
|
|
|
|
led_anim1(io)
|
2015-04-13 07:37:46 -04:00
|
|
|
print("{:02X}".format(io.read()))
|
2015-04-13 07:46:06 -04:00
|
|
|
# # #
|
2015-04-13 07:09:44 -04:00
|
|
|
wb.close()
|