Add write_raw_reg() library function and use it to implement a faster toggle in the test progrm