?非常抱歉误导了大家 以前的写法会让波形不正常? 但我已经写出正确方式了 大家参考:
import pyhackrf2 as pyhackrf
import numpy as np
import ook as ook
from multiprocessing import Array
import threading
buffer = [0xff,0x09]
raw = ook.tx_data(buffer)
class hackrf_threading(threading.Thread):
def __init__(self):
self.hackrf = pyhackrf.HackRF()
self.hackrf.center_freq = 433.92e6
self.hackrf.lna_gain = 40
self.hackrf.txvga_gain = 62
self.hackrf.filter_bandwidth = self.hackrf.set_bw(1000000)
self.hackrf.buffer = bytearray(raw)
def run(self):
self.hackrf.start_tx()
h = hackrf_threading()
h.run()