completed i2c, pwm, adc sw implementation