Copyright | (c) Marc Fontaine 2017 |
---|---|
License | BSD3 |
Maintainer | Marc.Fontaine@gmx.de |
Stability | experimental |
Portability | GHC-only |
Safe Haskell | None |
Language | Haskell2010 |
The WS1228Bs are popular RGB LED controllers for colorful decorations and mood lights etc. For proper operation the WS1228B requires fast and acurate timing. The example works with combination of SPI and DMA. With the SPI port it is possible to shift out a raw bitstream. (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 bit get extended to three bits
sendSPI :: ByteString -> MI () Source #
redIntensity :: Double -> Word8 Source #