Esempio n. 1
0
    def __init__(self):
        spi.setup("/dev/spidev4.0")

        
        self.modem_config_registers = [0x1c, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x2c, 0x2d, 0x2e, 0x58, 0x69, 0x6e, 0x6f, 0x70, 0x71, 0x72]


        self.cw_modem_settings = [0x2b, 0x03, 0xf4, 0x20, 0x41, 0x89, 0x00, 0x36, 0x40, 0x0a, 0x1d, 0x80, 0x60, 0x10, 0x62, 0x2c, 0x00, 0x08]


        self.fsk_bitrate = [2e3, 2.4e3, 4.8e3, 9.6e3, 19.2e3, 38.4e3, 57.6e3, 125e3]
        # self.fsk_deviation = [5e3, 36e3, 45e3, 45e3, 9.6e3, 19.6e3, 12.8e3, 125e3]
        self.fsk_modem_settings = np.array([[0x2b, 0x03, 0xf4, 0x20, 0x41, 0x89, 0x00, 0x36, 0x40, 0x0a, 0x1d, 0x80, 0x60, 0x10, 0x62, 0x2c, 0x22, 0x08],
                                            [0x1b, 0x03, 0x41, 0x60, 0x27, 0x52, 0x00, 0x07, 0x40, 0x0a, 0x1e, 0x80, 0x60, 0x13, 0xa9, 0x2c, 0x22, 0x3a],
                                            [0x1d, 0x03, 0xa1, 0x20, 0x4e, 0xa5, 0x00, 0x13, 0x40, 0x0a, 0x1e, 0x80, 0x60, 0x27, 0x52, 0x2c, 0x22, 0x48],
                                            [0x1e, 0x03, 0xd0, 0x00, 0x9d, 0x49, 0x00, 0x45, 0x40, 0x0a, 0x20, 0x80, 0x60, 0x4e, 0xa5, 0x2c, 0x22, 0x48],
                                            [0x2b, 0x03, 0x34, 0x02, 0x75, 0x25, 0x07, 0xff, 0x40, 0x0a, 0x1b, 0x80, 0x60, 0x9d, 0x49, 0x2c, 0x22, 0x0f],
                                            [0x02, 0x03, 0x68, 0x01, 0x3a, 0x93, 0x04, 0xd5, 0x40, 0x0a, 0x1e, 0x80, 0x60, 0x09, 0xd5, 0x0c, 0x22, 0x1f],
                                            [0x06, 0x03, 0x45, 0x01, 0xd7, 0xdc, 0x07, 0x6e, 0x40, 0x0a, 0x2d, 0x80, 0x60, 0x0e, 0xbf, 0x0c, 0x22, 0x2e], 
                                            [0x8a, 0x03, 0x60, 0x01, 0x55, 0x55, 0x02, 0xad, 0x40, 0x0a, 0x50, 0x80, 0x60, 0x20, 0x00, 0x0c, 0x22, 0xc8]])


        self.gfsk_bitrate = [2e3, 2.4e3, 4.8e3, 9.6e3, 19.2e3, 38.4e3, 57.6e3, 125e3]
        # self.gfsk_deviation = [5e3, 36e3, 45e3, 45e3, 9.6e3, 19.6e3, 12.8e3, 125e3]
        self.gfsk_modem_settings = np.array([[0x2b, 0x03, 0xf4, 0x20, 0x41, 0x89, 0x00, 0x36, 0x40, 0x0a, 0x1d, 0x80, 0x60, 0x10, 0x62, 0x2c, 0x23, 0x08],
                                             [0x1b, 0x03, 0x41, 0x60, 0x27, 0x52, 0x00, 0x07, 0x40, 0x0a, 0x1e, 0x80, 0x60, 0x13, 0xa9, 0x2c, 0x23, 0x3a],
                                             [0x1d, 0x03, 0xa1, 0x20, 0x4e, 0xa5, 0x00, 0x13, 0x40, 0x0a, 0x1e, 0x80, 0x60, 0x27, 0x52, 0x2c, 0x23, 0x48],
                                             [0x1e, 0x03, 0xd0, 0x00, 0x9d, 0x49, 0x00, 0x45, 0x40, 0x0a, 0x20, 0x80, 0x60, 0x4e, 0xa5, 0x2c, 0x23, 0x48],
                                             [0x2b, 0x03, 0x34, 0x02, 0x75, 0x25, 0x07, 0xff, 0x40, 0x0a, 0x1b, 0x80, 0x60, 0x9d, 0x49, 0x2c, 0x23, 0x0f],
                                             [0x02, 0x03, 0x68, 0x01, 0x3a, 0x93, 0x04, 0xd5, 0x40, 0x0a, 0x1e, 0x80, 0x60, 0x09, 0xd5, 0x0c, 0x23, 0x1f],
                                             [0x06, 0x03, 0x45, 0x01, 0xd7, 0xdc, 0x07, 0x6e, 0x40, 0x0a, 0x2d, 0x80, 0x60, 0x0e, 0xbf, 0x0c, 0x23, 0x2e],
                                             [0x8a, 0x03, 0x60, 0x01, 0x55, 0x55, 0x02, 0xad, 0x40, 0x0a, 0x50, 0x80, 0x60, 0x20, 0x00, 0x0c, 0x23, 0xc8]])
    def __init__(self, file_num):

        self.file_num = file_num
        interrupt = 157
        tx_port = 138
        rx_port = 139

        spi.setup("/dev/spidev4.0")

        # setup the TR switch
        self.tx_ant = GeneralPurposeIO(tx_port, "out")
        self.tx_ant.write(0)

        self.rx_ant = GeneralPurposeIO(rx_port, "out")
        self.rx_ant.write(0)

        # setup irq line
        self.irq = GeneralPurposeIO(interrupt, "in")

        self.packet =[0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 
                      0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D,
                      0x3E, 0x3F, 0x78]

        self.rssi_data = []
        self.packet_count = 0
    def _init_io(self):
        """
        Initiallize I/O lines.

        """
        
        # TODO: add error handling for spi_dev, or is this handled at a lower lever?
        spi.setup(self.spi_dev)

        s = "echo " + str(self.tx_port) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
        s = "echo out > /sys/class/gpio/gpio" + str(self.tx_port) + "/direction"
        result = subprocess.call(s, shell=True)
        s = "echo 0 > /sys/class/gpio/gpio" + str(self.tx_port) + "/value"
        result = subprocess.call(s, shell=True)

        s = "echo " + str(self.rx_port) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
        s = "echo out > /sys/class/gpio/gpio" + str(self.rx_port) + "/direction"
        result = subprocess.call(s, shell=True)
        s = "echo 0 > /sys/class/gpio/gpio" + str(self.rx_port) + "/value"
        result = subprocess.call(s, shell=True)

        s = "echo " + str(int_port) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
Esempio n. 4
0
    def __init__(self, file_num):

        self.file_num = file_num
        interrupt = 157
        tx_port = 138
        rx_port = 139

        spi.setup("/dev/spidev4.0")

        # setup the TR switch
        self.tx_ant = GeneralPurposeIO(tx_port, "out")
        self.tx_ant.write(0)

        self.rx_ant = GeneralPurposeIO(rx_port, "out")
        self.rx_ant.write(0)

        # setup irq line
        self.irq = GeneralPurposeIO(interrupt, "in")

        self.packet = [
            0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
            0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x78
        ]

        self.rssi_data = []
        self.packet_count = 0
Esempio n. 5
0
    def _init_io(self):
        interrupt = 157
        tx_port = 138
        rx_port = 139

        spi.setup("/dev/spidev4.0")

        # setup the TR switch
        self.tx_ant = GeneralPurposeIO(tx_port, "out")
        self.tx_ant.write(0)
        self.rx_ant = GeneralPurposeIO(rx_port, "out")
        self.rx_ant.write(0)

        # setup irq line
        self.irq = GeneralPurposeIO(interrupt, "in")
    def _init_io(self):
        interrupt = 157
        tx_port = 138
        rx_port = 139

        spi.setup("/dev/spidev4.0")

        # setup the TR switch
        self.tx_ant = GeneralPurposeIO(tx_port, "out")
        self.tx_ant.write(0)
        self.rx_ant = GeneralPurposeIO(rx_port, "out")
        self.rx_ant.write(0)

        # setup irq line
        self.irq = GeneralPurposeIO(interrupt, "in")
    def __init__(self):
        interrupt = 157
        tx_port = 138
        rx_port = 139

        spi.setup("/dev/spidev4.0")

        # setup the TR switch
        self.tx_ant = gpio(tx_port, "out")
        self.tx_ant.write(0)

        self.rx_ant = gpio(rx_port, "out")
        self.rx_ant.write(0)

        # setup irq line
        self.irq = gpio(interrupt, "in")
Esempio n. 8
0
    def __init__(self):
        nint_port = 157
        tx_port = 138
        rx_port = 139

        spi.setup("/dev/spidev4.0")

        # setup the TR switch
        self.tx_ant = gpio(tx_port, "out")
        self.tx_ant.write(0)

        self.rx_ant = gpio(rx_port, "out")
        self.rx_ant.write(0)

        # setup irq line
        self.irq = gpio(nint_port, "in")
Esempio n. 9
0
    def __init__(self):
        spi.setup("/dev/spidev4.0")

        s = "echo " + str(tx_port) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
        s = "echo out > /sys/class/gpio/gpio" + str(tx_port) + "/direction"
        result = subprocess.call(s, shell=True)
        s = "echo 0 > /sys/class/gpio/gpio" + str(tx_port) + "/value"
        result = subprocess.call(s, shell=True)

        s = "echo " + str(rx_port) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
        s = "echo out > /sys/class/gpio/gpio" + str(rx_port) + "/direction"
        result = subprocess.call(s, shell=True)
        s = "echo 0 > /sys/class/gpio/gpio" + str(rx_port) + "/value"
        result = subprocess.call(s, shell=True)

        s = "echo " + str(interrupt) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
Esempio n. 10
0
    def __init__(self):
        spi.setup("/dev/spidev4.0")

        s = "echo " + str(tx_port) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
        s = "echo out > /sys/class/gpio/gpio" + str(tx_port) + "/direction"
        result = subprocess.call(s, shell=True)
        s = "echo 0 > /sys/class/gpio/gpio" + str(tx_port) + "/value"
        result = subprocess.call(s, shell=True)

        s = "echo " + str(rx_port) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
        s = "echo out > /sys/class/gpio/gpio" + str(rx_port) + "/direction"
        result = subprocess.call(s, shell=True)
        s = "echo 0 > /sys/class/gpio/gpio" + str(rx_port) + "/value"
        result = subprocess.call(s, shell=True)

        s = "echo " + str(interrupt) + " > /sys/class/gpio/export"
        result = subprocess.call(s, shell=True)
Esempio n. 11
0
    def _init_io(self):
        """
        Initialize I/O.

        This function initializes the radio I/O, including SPI, GPIO,
        and IRQ line.
        """        
        interrupt = 157
        tx_port = 138
        rx_port = 139

        spi.setup("/dev/spidev4.0")

        # setup the TR switch
        self.tx_ant = GeneralPurposeIO(tx_port, "out")
        self.tx_ant.write(0)
        self.rx_ant = GeneralPurposeIO(rx_port, "out")
        self.rx_ant.write(0)

        # setup irq line
        self.irq = GeneralPurposeIO(interrupt, "in")
Esempio n. 12
0
    def _init_io(self):
        """
        Initialize I/O.

        This function initializes the radio I/O, including SPI, GPIO,
        and IRQ line.
        """
        interrupt = 157
        tx_port = 138
        rx_port = 139

        spi.setup("/dev/spidev4.0")

        # setup the TR switch
        self.tx_ant = GeneralPurposeIO(tx_port, "out")
        self.tx_ant.write(0)
        self.rx_ant = GeneralPurposeIO(rx_port, "out")
        self.rx_ant.write(0)

        # setup irq line
        self.irq = GeneralPurposeIO(interrupt, "in")
Esempio n. 13
0
 def __init__(self):
     spi.setup("/dev/spidev4.0")
Esempio n. 14
0
 def __init__(self):
     spi.setup("/dev/spidev4.0")
Esempio n. 15
0
    def __init__(self):
        spi.setup("/dev/spidev4.0")

        self.modem_config_registers = [
            0x1c, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x2c, 0x2d, 0x2e,
            0x58, 0x69, 0x6e, 0x6f, 0x70, 0x71, 0x72
        ]

        self.cw_modem_settings = [
            0x2b, 0x03, 0xf4, 0x20, 0x41, 0x89, 0x00, 0x36, 0x40, 0x0a, 0x1d,
            0x80, 0x60, 0x10, 0x62, 0x2c, 0x00, 0x08
        ]

        self.fsk_bitrate = [
            2e3, 2.4e3, 4.8e3, 9.6e3, 19.2e3, 38.4e3, 57.6e3, 125e3
        ]
        # self.fsk_deviation = [5e3, 36e3, 45e3, 45e3, 9.6e3, 19.6e3, 12.8e3, 125e3]
        self.fsk_modem_settings = np.array(
            [[
                0x2b, 0x03, 0xf4, 0x20, 0x41, 0x89, 0x00, 0x36, 0x40, 0x0a,
                0x1d, 0x80, 0x60, 0x10, 0x62, 0x2c, 0x22, 0x08
            ],
             [
                 0x1b, 0x03, 0x41, 0x60, 0x27, 0x52, 0x00, 0x07, 0x40, 0x0a,
                 0x1e, 0x80, 0x60, 0x13, 0xa9, 0x2c, 0x22, 0x3a
             ],
             [
                 0x1d, 0x03, 0xa1, 0x20, 0x4e, 0xa5, 0x00, 0x13, 0x40, 0x0a,
                 0x1e, 0x80, 0x60, 0x27, 0x52, 0x2c, 0x22, 0x48
             ],
             [
                 0x1e, 0x03, 0xd0, 0x00, 0x9d, 0x49, 0x00, 0x45, 0x40, 0x0a,
                 0x20, 0x80, 0x60, 0x4e, 0xa5, 0x2c, 0x22, 0x48
             ],
             [
                 0x2b, 0x03, 0x34, 0x02, 0x75, 0x25, 0x07, 0xff, 0x40, 0x0a,
                 0x1b, 0x80, 0x60, 0x9d, 0x49, 0x2c, 0x22, 0x0f
             ],
             [
                 0x02, 0x03, 0x68, 0x01, 0x3a, 0x93, 0x04, 0xd5, 0x40, 0x0a,
                 0x1e, 0x80, 0x60, 0x09, 0xd5, 0x0c, 0x22, 0x1f
             ],
             [
                 0x06, 0x03, 0x45, 0x01, 0xd7, 0xdc, 0x07, 0x6e, 0x40, 0x0a,
                 0x2d, 0x80, 0x60, 0x0e, 0xbf, 0x0c, 0x22, 0x2e
             ],
             [
                 0x8a, 0x03, 0x60, 0x01, 0x55, 0x55, 0x02, 0xad, 0x40, 0x0a,
                 0x50, 0x80, 0x60, 0x20, 0x00, 0x0c, 0x22, 0xc8
             ]])

        self.gfsk_bitrate = [
            2e3, 2.4e3, 4.8e3, 9.6e3, 19.2e3, 38.4e3, 57.6e3, 125e3
        ]
        # self.gfsk_deviation = [5e3, 36e3, 45e3, 45e3, 9.6e3, 19.6e3, 12.8e3, 125e3]
        self.gfsk_modem_settings = np.array(
            [[
                0x2b, 0x03, 0xf4, 0x20, 0x41, 0x89, 0x00, 0x36, 0x40, 0x0a,
                0x1d, 0x80, 0x60, 0x10, 0x62, 0x2c, 0x23, 0x08
            ],
             [
                 0x1b, 0x03, 0x41, 0x60, 0x27, 0x52, 0x00, 0x07, 0x40, 0x0a,
                 0x1e, 0x80, 0x60, 0x13, 0xa9, 0x2c, 0x23, 0x3a
             ],
             [
                 0x1d, 0x03, 0xa1, 0x20, 0x4e, 0xa5, 0x00, 0x13, 0x40, 0x0a,
                 0x1e, 0x80, 0x60, 0x27, 0x52, 0x2c, 0x23, 0x48
             ],
             [
                 0x1e, 0x03, 0xd0, 0x00, 0x9d, 0x49, 0x00, 0x45, 0x40, 0x0a,
                 0x20, 0x80, 0x60, 0x4e, 0xa5, 0x2c, 0x23, 0x48
             ],
             [
                 0x2b, 0x03, 0x34, 0x02, 0x75, 0x25, 0x07, 0xff, 0x40, 0x0a,
                 0x1b, 0x80, 0x60, 0x9d, 0x49, 0x2c, 0x23, 0x0f
             ],
             [
                 0x02, 0x03, 0x68, 0x01, 0x3a, 0x93, 0x04, 0xd5, 0x40, 0x0a,
                 0x1e, 0x80, 0x60, 0x09, 0xd5, 0x0c, 0x23, 0x1f
             ],
             [
                 0x06, 0x03, 0x45, 0x01, 0xd7, 0xdc, 0x07, 0x6e, 0x40, 0x0a,
                 0x2d, 0x80, 0x60, 0x0e, 0xbf, 0x0c, 0x23, 0x2e
             ],
             [
                 0x8a, 0x03, 0x60, 0x01, 0x55, 0x55, 0x02, 0xad, 0x40, 0x0a,
                 0x50, 0x80, 0x60, 0x20, 0x00, 0x0c, 0x23, 0xc8
             ]])