the template is a recipe, not a cake. there is no code generated for template. code exists only for functions or classes generated from the template for specific set of template parameters. So the entire template function definition must be in .h to generate a specific function for parameter types in .ino or in some cpp