Moved handling of communications between PC and TX, and PC and RX, to api.c