diff options
author | Tzafrir Cohen <tzafrir@cohens.org.il> | 2016-05-27 00:12:38 +0300 |
---|---|---|
committer | Tzafrir Cohen <tzafrir@cohens.org.il> | 2016-05-27 00:12:38 +0300 |
commit | 60ff01b550a47c0de3b3950ed683d7d774a56b8e (patch) | |
tree | a448d5c0a5f579471cc7fba9f556ebda76208e27 /freack_gen.hs |
freack_gen now generates a single green color
Diffstat (limited to 'freack_gen.hs')
-rw-r--r-- | freack_gen.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/freack_gen.hs b/freack_gen.hs new file mode 100644 index 0000000..6802a8a --- /dev/null +++ b/freack_gen.hs @@ -0,0 +1,32 @@ +import qualified Data.ByteString.Lazy as BL +import Data.Binary.Put + +s_delay = 0 +num_cycles = 1 +colors_list = [(0x32, 0x30)] -- green + +magic 1 x = 2 + 6 * x + +color_number t = fst t * 2^8 + snd t + +serialiseSomething :: Put +serialiseSomething = do + putWord16le 0x5aa5 + putWord16le s_delay + putWord16le 0x101 + putWord16le 0x101 + putWord16le 0x1 + putWord16le 0 + putWord16le 0 + putWord16le 0 + putWord16le 0 + putWord16le 0 + putWord16le num_cycles + putWord16le $ fromIntegral $ length colors_list + putWord16le $ magic num_cycles 1 + putWord16le $ fromIntegral $ color_number $ head colors_list + +main :: IO () +main = BL.putStr $ runPut serialiseSomething + + |