License | MIT |
---|---|
Maintainer | Alexander Isenko <alex.isenko@googlemail.com> |
Safe Haskell | Safe |
Language | Haskell2010 |
Format.C
exports the Platform datatype and the needed formatting for the .c
file
Documentation
toCFile :: [String] -> (String, String) -> (Int, Int) -> UTCTime -> Platform -> String Source
toCFile gets five arguments
[String]
are the hex strings(String, String)
is the (filename, file extention)(Int, Int)
is the (width, height)UTCTime
is the current timePlatform
is the desired platform to convert to
The result is a the string which is the full c file with header + unsigned short array + comments
The created \n
were reformatted by hand
Example usage:
λ> let hex = ["0000", "0000", "FF00", "00FF","0000", "0000", "FF00", "00FF", "0000", "0000", "FF00", "00FF", "0000", "0000", "FF00", "00FF"] λ> time <- getCurrentTime λ> toCFile hex ("example", ".jpg") (4,4) time AVR "// Generated by : UTFTConverter v0.1 // Generated from : example.jpg // Time generated : 2015-09-01 19:56:40.438958 UTC // Image Size : 4x4 pixels // Memory usage : 32 bytes #include <avr/pgmspace.h> const unsigned short example[16] PROGMEM={ 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, // 0x0010 (16) pixels };"