This is a copy of the C code required to read and write to TG-UV2. The original was found here: https://chirp.danplanet.com/issues/2311