Copyright | (c) Marc Fontaine 2017 |
---|---|
License | BSD3 |
Maintainer | Marc.Fontaine@gmx.de |
Stability | experimental |
Portability | GHC-only |
Safe Haskell | None |
Language | Haskell2010 |
The popular WS1228B module consists of a RGB LED and an included LED controller. Many WS1228B modules can be chained up to build LED strips for colorful decorations, mood lights etc. For proper operation the WS1228B requires fast and accurate timing. The example works with combination of SPI and DMA. With the SPI port it is possible to shift out a raw bit-stream. (i.e. play a one-bit sampled wave-form). (This is not possible with the USART because the USART would add start and stop bits)
- data RGB = RGB Word8 Word8 Word8
- testLEDs :: IO ()
- ledsOff30 :: IO ()
- sendLEDs :: [RGB] -> IO ()
- black :: RGB
- white :: RGB
- red :: RGB
- green :: RGB
- blue :: RGB
- encodeRGBLine :: [RGB] -> ByteString
- resetCode :: ByteString
- encodeRGB :: RGB -> ByteString
- lineCodeWord8 :: Word8 -> (Word8, Word8, Word8)
- led :: Wire
- spi_mosi :: Wire
- spiConfig :: Config
- initSPI :: MI ()
- sendSPI :: ByteString -> MI ()
- testWave :: IO ()
- wave :: Double -> Double -> Int -> Double
- redIntensity :: Double -> Word8
Documentation
encodeRGBLine :: [RGB] -> ByteString Source #
The WS1228B protocoll. translate a list of colors to the transmission bits.
encodeRGB :: RGB -> ByteString Source #
lineCodeWord8 :: Word8 -> (Word8, Word8, Word8) Source #
Encode an Word8 according to the WS1228B line code. Each data bit is extended to a three bit line code.
sendSPI :: ByteString -> MI () Source #
redIntensity :: Double -> Word8 Source #