Magnesium Doped Hydroxyapatite-Based Coatings Obtained by Pulsed Galvanostatic Electrochemical Deposition with Adjustable Electrochemical Behavior