HW and SW for current sensor