How to create data types via module
Instead of attempting to create your datatype module from scratch, use the Features module to store your content type settings in a feature generated module.  This is faster, but may not cover all of the options that you need (field order, field groups or autotitle.)