adding charging code c and h fines

using the rough charging code i wrote before, I am adding the definition
of the function for testing on the board