LEDs module =========== The LEDs module allows controlling the LEDs of the board. Python API example ------------------ .. code-block:: python # Adjust LEDs brightness # 0 is minimum # 1 is maximum scaffold.leds.brightness = 0.5 # Toggle a LED every second scaffold.leds.d0.mode = LEDMode.VALUE for i in range(10): time.sleep(1) scaffold.d0 << 1 time.sleep(1) scaffold.d0 << 0 # Now flash the LED every second scaffold.leds.d0.mode = LEDMode.EVENT for i in range(10): time.sleep(1) scaffold.d0 << 1 time.sleep(1) scaffold.d0 << 0 LEDs mode --------- A/B/C/D LEDs can be lit according to two different modes: - Event mode: the LED will flash when an rising or falling edge occurs on the monitored signal. This is the default mode. This mode allows seeing activity on the LED even when very short pulses happen. - Value mode: the LED is ON when the monitored signal is high. When using this mode, a user may not be able to catch very short pulses. This mode is more appropriate for watching slow signals. Registers --------- +--------+------------+---+ | 0x0200 | control | W | +--------+------------+---+ | 0x0201 | brightness | W | +--------+------------+---+ | 0x0202 | leds_0 | W | +--------+------------+---+ | 0x0203 | leds_1 | W | +--------+------------+---+ | 0x0204 | leds_2 | W | +--------+------------+---+ | 0x0205 | mode | W | +--------+------------+---+ control register ^^^^^^^^^^^^^^^^ +---+---+---+---+---+---+----------+---------+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---+---+---+---+---+---+----------+---------+ | *reserved* | override | disable | +-----------------------+----------+---------+ disable Write 1 to disable TLC5927 drivers output. Default is 0 (enabled). override Sets the LEDs of the board to the values defined in led_n registers. brightness registers ^^^^^^^^^^^^^^^^^^^^ +------------+---+---+---+---+---+---+---+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +------------+---+---+---+---+---+---+---+ | *reserved* | brightness | +------------+---------------------------+ brightness 7-bits word which controls the brightness of the LEDs. See TLC5952 datasheet for more details. leds_n registers ^^^^^^^^^^^^^^^^ *leds_n* registers define the state of the LEDs of the board when override bit is set. Set a bit to 1 to turn the corresponding LED on, 0 to turn it off. Value on reset is 0x00. mode register ^^^^^^^^^^^^^ +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---+---+---+---+---+---+ | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---+---+---+---+---+---+ | *reserved* | d5 | d4 | d3 | d2 | d1 | d0 | c1 | c0 | b1 | b0 | a1 | a0 | *reserved* | +-----------------------------+----+----+----+----+----+----+----+----+----+----+----+----+-----------------------+ mode register is a 24-bit register. Write three times to update all the bits of this register. Each bit of this register sets the lighting mode of a LED. When bit is 0, the corresponding LED will blink on a falling or rising edge of the monitored signal. When the bit is 1, the LED will be lit as long as the monitored signal is high. Default mode is 0 (event mode) for all LEDs.