LED Pattern

Implement a simple visual pattern using the onboard LEDs, a sine wave stored in LUTs, and PWM.


In [1]:
%%HTML
<video width="320" height="240" controls>
  <source src="images/pattern.mp4" type="video/mp4">
</video>



In [ ]:
import sys
import magma as m
m.set_mantle_target("ice40")
import mantle
from loam.boards.icestick import IceStick
import math

icestick = IceStick()
icestick.Clock.on()
# Configure 5 LEDs
icestick.D1.on()
icestick.D2.on()
icestick.D3.on()
icestick.D4.on()
icestick.D5.on()

main = icestick.main()

# TODO: Define main

m.compile("build/sin_leds", main)

In [ ]:
%%bash
cd build
yosys -q -p 'synth_ice40 -top main -blif sin_leds.blif' sin_leds.v
arachne-pnr -q -d 1k -o sin_leds.txt -p sin_leds.pcf sin_leds.blif 
icepack sin_leds.txt sin_leds.bin
iceprog sin_leds.bin