mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Add files via upload
This commit is contained in:
parent
a697b87087
commit
0805d3bca7
1 changed files with 6 additions and 5 deletions
|
@ -13,6 +13,7 @@ import binascii #required for string.to_bytes() function
|
|||
import sys
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
modem = FreeDV() #Load FreeDV Class as "modem"
|
||||
|
@ -55,15 +56,15 @@ class FreeDV():
|
|||
buffer[:len(data_list[i])] = data_list[i] # set buffersize to length of data which will be send
|
||||
|
||||
crc = c_ushort(self.c_lib.freedv_gen_crc16(bytes(buffer), self.payload_per_frame)) # generate CRC16
|
||||
crc = crc.value.to_bytes(2, byteorder='big') # convert buffer to 2 byte hex string
|
||||
crc = crc.value.to_bytes(2, byteorder='big') # convert crc to 2 byte hex string
|
||||
buffer += crc # append crc16 to buffer
|
||||
|
||||
data = self.FrameBytes().from_buffer_copy(buffer) #change data format form bytearray to ctypes.u_byte
|
||||
data = self.FrameBytes().from_buffer_copy(buffer) #change data format from bytearray to ctypes.u_byte
|
||||
|
||||
self.c_lib.freedv_rawdatatx(self.freedv,mod_out,data) # modulate DATA
|
||||
self.c_lib.freedv_rawdatatx(self.freedv,mod_out,data) # modulate DATA and safe it into mod_out pointer
|
||||
|
||||
sys.stdout.buffer.write(mod_out) # the normal way of piping data
|
||||
sys.stdout.flush() # flushing data
|
||||
sys.stdout.buffer.write(mod_out) # print data to terminal for piping the output to other programs
|
||||
sys.stdout.flush() # flushing stdout
|
||||
|
||||
|
||||
main()
|
Loading…
Reference in a new issue