UTFTConverter-0.1.0.1: Processing popular picture formats into .c or .raw format in RGB565

LicenseMIT
MaintainerAlexander Isenko <alex.isenko@googlemail.com>
Safe HaskellSafe
LanguageHaskell2010

Format.C

Description

Format.C exports the Platform datatype and the needed formatting for the .c file

Synopsis

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 time
  • Platform 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
};"

data Platform Source

The Platform datatype has three constructors, for every supported architecture

The Show instance is derived

Constructors

AVR 
ARM 
PIC32 

Instances