Skip to content

Commit

Permalink
docs/psoc6: Neopixel documentation.
Browse files Browse the repository at this point in the history
Signed-off-by: IFX-Anusha <Anusha.TR@infineon.com>
  • Loading branch information
IFX-Anusha committed Aug 23, 2024
1 parent 4d20c48 commit 8622ae1
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions docs/psoc6/quickref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,40 @@ The :mod:`machine` module::

from machine import bitstream
timing = [1000, 7000, 5000, 2500] #timing (high_time_0, low_time_0, high_time_1, low_time_1)in ns
buf = bytearray([0xAB]) #buffer data
timing = [1000, 7000, 5000, 2500] # timing (high_time_0, low_time_0, high_time_1, low_time_1)in ns
buf = bytearray([0xAB]) # buffer data
bitstream('P13_6', 0, timing, buf) # bitstrem buffer data with timing through pin P13_6

.. note::
Bitstream is set for the CPU frequency of 100MHz. At other clock frequencies, the timing will not fit.
All timings greater than 1500 ns work and the accuracy of the timing is +/- 400 ns.
Supported timing_ns ranges below 1500 ns is [500, 1125, 800, 750].
Supported timing_ns ranges below 1500 ns are [500, 1125, 800, 750], [400, 850, 800, 450], [300, 900, 600, 600] and [800, 1700, 1600, 900].

Neopixel driver
---------------

Neopixel library is supported in this port. The library can be installed using mip.

::

import mip
mip.install('neopixel')

neopixel driver can be used as follows. see the :mod:`neopixel` for more details.

::

import neopixel
from machine import Pin
p0 = Pin('P9_1', Pin.OUT, value=0) # set P9_1 to output to drive NeoPixels
np = neopixel.NeoPixel(p0,8,bpp=3) # create NeoPixel object on pin P9_1 with 8 pixels and 3 bytes per pixel with default timing=1
np[0] = (255, 255, 255) # set the first pixel to white
np.write() # write data to all pixels

.. note::
- The timing parameter can be used in the Neopixel constructor as timing tuples supported by bitstream() function. The timing parameter is optional and by default set to 1 which is the default timing [400, 850, 800, 450] for WS2812B LEDs at 800kHz.
- Use timing = 0 for WS2812B LEDs at 400kHz ie, [800, 1700, 1600, 900].
- Use timing = [300, 900, 600, 600] for SK612 LEDs.

Delay and timing
----------------
Expand Down

0 comments on commit 8622ae1

Please sign in to comment.