there are so many h-bridge control ics are available.such as IR2111, IR2113.... like that. the circuit is depending on the ics. as well the c code is also varying according to that. so the best thing is to choose a circuit, then start to write down the coding.