Пример #1
0
    def __init__(self, callback):
        self.callback = callback
        self.cc2538Spi = mySPI(0)
        self.cc2520Spi = mySPI(1)
        self.cc2538DataReadyInt = mraa.Gpio(CC2538INTPINNUM)
        self.cc2538DataReadyInt.dir(mraa.DIR_IN)
        self.cc2538DataReadyInt.isr(mraa.EDGE_RISING, triumviCallBackISR, 8)
        self.cc2538Reset = mraa.Gpio(CC2538RESETPINNUM)
        self.cc2538Reset.dir(mraa.DIR_OUT)
        self.cc2538Reset.write(0) # active low
        self.cc2538Reset.write(1) # active low
        self.resetCount = 0

        self.redLed     = edisonLED('red')
        self.greenLed   = edisonLED('green')
        self.blueLed    = edisonLED('blue')
        # macro, don't touch
        self._SPI_MASTER_REQ_DATA = 0
        self._SPI_MASTER_DUMMY = 1
        self._SPI_MASTER_GET_DATA = 2
        self._SPI_MASTER_RADIO_ON = 3
        self._SPI_MASTER_RADIO_OFF = 4
        self._SPI_RF_PACKET_SEND = 5

        condition.acquire()
        while True:
            condition.wait()
            # When we have been notified we want to read the cc2538
            self.cc2538ISR()

            # Keep reading while there are pending interrupts
            while self.cc2538DataReadyInt.read() == 1:
                self.cc2538ISR()
Пример #2
0
    def __init__(self, callback):
        self.callback = callback
        self.cc2538Spi = mySPI(0)
        self.cc2520Spi = mySPI(1)
        self.cc2538DataReadyInt = mraa.Gpio(CC2538INTPINNUM)
        self.cc2538DataReadyInt.dir(mraa.DIR_IN)
        self.cc2538DataReadyInt.isr(mraa.EDGE_RISING, triumviCallBackISR, 8)
        self.cc2538Reset = mraa.Gpio(CC2538RESETPINNUM)
        self.cc2538Reset.dir(mraa.DIR_OUT)
        self.cc2538Reset.write(0)  # active low
        self.cc2538Reset.write(1)  # active low
        self.resetCount = 0

        self.redLed = edisonLED('red')
        self.greenLed = edisonLED('green')
        self.blueLed = edisonLED('blue')

        self.waveform_packets = []
        # macro, don't touch
        self._SPI_MASTER_REQ_DATA = 0
        self._SPI_MASTER_DUMMY = 1
        self._SPI_MASTER_GET_DATA = 2
        self._SPI_MASTER_RADIO_ON = 3
        self._SPI_MASTER_RADIO_OFF = 4
        self._SPI_RF_PACKET_SEND = 5
        self._SPI_MASTER_SET_TIME = 6
        self._SPI_MASTER_RST_RF_FIFO = 7
        # delay 0.5 seconds for 2538 to boot
        time.sleep(0.5)
        self.updateTimeThreadEvent = threading.Event()
        self.updateTimeThread = threading.Thread(target=self.updateTime,
                                                 args=())
        self.updateTimeThread.start()

        signal.signal(signal.SIGINT, self.signal_handler)

        condition.acquire()
        while True:
            condition.wait()
            # When we have been notified we want to read the cc2538
            self.cc2538ISR()

            # Keep reading while there are pending interrupts
            while self.cc2538DataReadyInt.read() == 1:
                self.cc2538ISR()
Пример #3
0
    def __init__(self):
        self.cc2538Spi = mySPI(0)
        self.cc2520Spi = mySPI(1)
        self.cc2538DataReadyInt = mraa.Gpio(CC2538INTPINNUM)
        self.cc2538DataReadyInt.dir(mraa.DIR_IN)
        self.cc2538DataReadyInt.isr(mraa.EDGE_RISING, triumviCallBackISR, self)
        self.cc2538Reset = mraa.Gpio(CC2538RESETPINNUM)
        self.cc2538Reset.dir(mraa.DIR_OUT)
        self.cc2538Reset.write(0) # active low
        self.cc2538Reset.write(1) # active low

        self.redLed     = edisonLED('red')
        self.greenLed   = edisonLED('green')
        self.blueLed    = edisonLED('blue')
        # macro, don't touch
        self._SPI_MASTER_REQ_DATA = 0
        self._SPI_MASTER_DUMMY = 1
        self._SPI_MASTER_GET_DATA = 2