# ws2812b_sw

Library to support a chain of WS2812B chips by bit-banging

Author | Rob Hamerling, Copyright © 2014..2014, all rights reserved.
Adapted-by |
Compiler | 2.4q2

Description

    Library to control a chain of WS2812Bs
    This library uses 'bit banging' to transfer data to the WS2812Bs.
    - A PIC with Fosc of at least 32 MHz is required.
    - The user program must specify an alias for the control pin, like:
         alias pin_WS2812B is pin_A1       -- pin_A1 used for WS2812B control
      and the chosen pin must be configured for digital output.
    - The number of WS2812Bs in the chain must be specified, like:
         const byte WS2812B_NUM = 30       -- for 30 chained WS2812Bs
    - The user program should contain 3 byte arrays of WS2812B_NUM bytes each, e.g.:
         var byte agreen[WS2812B_NUM]
         var byte ared[WS2812B_NUM]
         var byte ablue[WS2812B_NUM]
      and call the procedure ws2812b_refresh() to pass the current color settings
      in these arrays to the WS2812B LEDs.
    - Procedure ws2812b_all_color() can be used to set all LEDs to the same color
      while keeping the color settings in the array unchanged.

Dependencies

- ws2812b_common

## Summary

### Global variables/contants

### Procedures

- `ws2812b_sw_init()`

Private

- `_transfer_bit_1()`
- `_transfer_bit_0()`
- `_ws2812b_write_pixel(byte in green, byte in red, byte in blue)`

### Functions

## API details

### Global variables/contants

### Procedures

- `ws2812b_sw_init()`

      Title: Initialize the Software ws2812b interface
      Input: (none)
      Notes: No initialization needed, procedure here just for uniformity

Private

- `_transfer_bit_1()`

       transfer a '1' WS2812B bit to the chain

- `_transfer_bit_0()`

       transfer a '0' WS2812B bit to the chain

- `_ws2812b_write_pixel(byte in green, byte in red, byte in blue)`

      Title:  Transfer 3 color bytes to the WS2812B chain
      Input:  Color intensities of green, red and blue (3 bytes)
      Notes:  - Transfer 24 WS2812B bits

### Functions

## Related samples

Here are the list of samples which use this library:

12f1840 | 12f1840_ws2812b_sw.jal
18f14k22 | 18f14k22_ws2812b_sw.jal
18f25k22 | 18f25k22_ws2812b_sw.jal