Package: d578uv-k0hax
k0hax-d578uvThis is a python library designed to interface to an AnyTone™ AT-D578UV radio's Microphone port serial connection.FeaturesControl the radio's PTT lineSend keypad button pressesContinuously monitor the radio's statePerform callbacks on RX senseCopyright and LicenseCopyright © 2021 Michael EnglehornThis program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program.  If not, seehttps://www.gnu.org/licenses/.Installingpip install d578uv-k0haxExamplesControl PTTfrom d578uv import d578uv
radio = d578uv.d578uv('/dev/ttyUSB0')

# Transmit for 5 seconds
radio.Tx(5)

# Transmit until told to stop transmitting
radio.Tx()

# Stop transmitting, enter receive mode
radio.Rx()PicturesAT-578UVWiringIn order to determine which UART commands needed to be sent to the radio, and how the radio responds, I used a Bus Pirate byDangerous PrototypesI also built a small Cat5 cable breakout that split the cable between the radio and microphone, and allowed me to probe it while it was in operation.Decoded CommunicationsMicrophone to RadioNotesA single 0x06 packet is sent approximately once per second by the microphone to the radio as a type of keepaliveDescriptionByte 0PTTPressedLong PressButton AddressByte 5Byte 6Number of BytesPTT Pressed0x410x010x000x000x000x000x007PTT Released0x410x000x000x000x000x000x007A = Pressed0x410x000x010x000x1a0x000x007A = Held Long0x410x000x010x010x1a0x000x007A = Released0x410x000x000x010x1a0x000x007B = Pressed0x410x000x010x000x1b0x000x007B = Held Long0x410x000x010x010x1b0x000x007B = Released0x410x000x000x010x1b0x000x007C = Pressed0x410x000x010x000x1c0x000x007C = Held Long0x410x000x010x010x1c0x000x007C = Released0x410x000x000x010x1c0x000x007D = Pressed0x410x000x010x000x1d0x000x007D = Held Long0x410x000x010x010x1d0x000x007D = Released0x410x000x000x010x1d0x000x007D = Short 10x410x000x010x000x1d0x000x007D = Short 20x410x000x000x000x1d0x000x0071 = Pressed0x410x000x010x000x020x000x0072 = Pressed0x410x000x010x000x030x000x0073 = Pressed0x410x000x010x000x040x000x0074 = Pressed0x410x000x010x000x050x000x0075 = Pressed0x410x000x010x000x060x000x0076 = Pressed0x410x000x010x000x070x000x0077 = Pressed0x410x000x010x000x080x000x0078 = Pressed0x410x000x010x000x090x000x0079 = Pressed0x410x000x010x000x0a0x000x0070 = Pressed0x410x000x010x000x010x000x007* = Pressed0x410x000x010x000x0b0x000x007# = Pressed0x410x000x010x000x0c0x000x007SubPTT = Pressed0x410x000x010x000x0d0x000x007Down = Pressed0x410x000x010x000x110x000x007Up = Pressed0x410x000x010x000x100x000x007Button Address TableThis is for clarityButtonAddressPTT0x0000x0110x0220x0330x0440x0550x0660x0770x0880x0990x0a*0x0b#0x0cSubPTT0x0dUp0x10Down0x11A0x1aB0x1bC0x1cD0x1dRadio to MicrophoneDescriptionByte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8Byte 9Byte 10Byte 11Byte 12Byte 13Byte 14Byte 15RX Start, A0x530x010x010x000x000x000x000x000x000x100x000x000x000x000x000x06RX Stop, A0x530x000x000x000x000x000x000x000x000x100x000x000x000x000x000x06A to B0x530x000x000x000x000x000x000x010x000x100x000x000x000x000x000x06B to A0x530x000x000x000x000x000x000x000x000x100x000x000x000x000x000x06CMD Ack0xaaTX Start, A0x530x000x000x010x000x000x000x000x000x100x000x000x000x000x000x06TX Start, B0x530x000x000x000x000x000x010x010x000x100x000x000x000x000x000x06TX End, A0x530x000x000x000x000x000x000x000x000x100x000x000x000x000x000x06TX End, B0x530x000x000x000x000x000x000x010x000x100x000x000x000x000x000x06