Merge pull request #29 from sanderdh/master
clarify rgb.write_raw arguments
This commit is contained in:
commit
5456610441
1 changed files with 9 additions and 6 deletions
15
README.md
15
README.md
|
|
@ -335,18 +335,21 @@ The blinking LED is actually a hardware block from Lattice. It has control regi
|
||||||
|
|
||||||
There is a wrapper in Python that simplifies the process of writing to these registers. The first argument is the register number, and the second argument is the value to write.
|
There is a wrapper in Python that simplifies the process of writing to these registers. The first argument is the register number, and the second argument is the value to write.
|
||||||
|
|
||||||
|
For the `LEDDPWR` registers, the second argument determines the brightness, value ranges from 0 to 255.
|
||||||
|
|
||||||
Try changing the color of the three LEDs:
|
Try changing the color of the three LEDs:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
>>> LED_PULSE_WIDTH_RED = 0b0001 # LEDDPWRR
|
>>> ADDR_RED_LED_PULSE_WIDTH = 0b0001 # LEDDPWRR
|
||||||
>>> LED_PULSE_WIDTH_GREEN = 0b0010 # LEDDPWRG
|
>>> ADDR_GREEN_LED_PULSE_WIDTH = 0b0010 # LEDDPWRG
|
||||||
>>> LED_PULSE_WIDTH_BLUE = 0b0011 # LEDDPWRG
|
>>> ADDR_BLUE_LED_PULSE_WIDTH = 0b0011 # LEDDPWRB
|
||||||
>>> rgb.write_raw(LED_PULSE_WIDTH_RED, 255)
|
>>> rgb.write_raw(ADDR_RED_LED_PULSE_WIDTH, 255) # Red LED fully on
|
||||||
>>> rgb.write_raw(LED_PULSE_WIDTH_GREEN, 14)
|
>>> rgb.write_raw(ADDR_GREEN_LED_PULSE_WIDTH, 14) # Green LED mostly off
|
||||||
>>> rgb.write_raw(LED_PULSE_WIDTH_BLUE, 1)
|
>>> rgb.write_raw(ADDR_BLUE_LED_PULSE_WIDTH, 1) # Blue LED off
|
||||||
>>>
|
>>>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
The color should change immediately. More information on these registers can be found in the [iCE40 LED Driver Usage Guide](reference/FPGA-TN-1288-ICE40LEDDriverUsageGuide.pdf).
|
The color should change immediately. More information on these registers can be found in the [iCE40 LED Driver Usage Guide](reference/FPGA-TN-1288-ICE40LEDDriverUsageGuide.pdf).
|
||||||
|
|
||||||
## Fomu as a CPU
|
## Fomu as a CPU
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue