Пример #1
0
 def __init__(self, cs = Pin.cpu.C0, spi = 1, fault_pin =  Pin.cpu.C1, ready_pin =  Pin.cpu.A13, latch_pin= Pin.cpu.A14):
     self.__SPI = spi_ic_interface(spi=SPI(spi, SPI.MASTER, baudrate=1000, polarity=0, phase=0), cs=cs)
     self.READY  =   Pin(ready_pin, Pin.IN)
     self.FAULT  =   Pin(fault_pin, Pin.IN)
     self.LATCH  =   Pin(latch_pin, Pin.OUT_PP)
     while(self.READY.value() == 1):
         time.sleep(0.1)
     self.set_latch_pin(1)    
Пример #2
0
 def __init__(self, cs=Pin.cpu.A4, spi=1):
     self.__SPI = spi_ic_interface(spi=SPI(spi,
                                           SPI.MASTER,
                                           baudrate=10000,
                                           polarity=0,
                                           phase=0),
                                   cs=cs)
     self.buildCRCTable()
     """if cout:
Пример #3
0
 def __init__(self, cs=Pin.cpu.A4, spi=1, cout=None):
     self.__SPI = spi_ic_interface(spi=SPI(spi,
                                           SPI.MASTER,
                                           baudrate=10000,
                                           polarity=0,
                                           phase=0),
                                   cs=cs)
     if cout:
         self.__COUT = Pin(cout, Pin.IN)
Пример #4
0
    def __init__(self, cs=Pin.cpu.A4, spi=1, intb=Pin.cpu.C6):
        """Initialization for MAX22007 class

        Args:
            cs (Pin, optional): Chip Select pin. Defaults to Pin.cpu.A4 on PMOD1
            spi (int, optional): Spi bus. Defaults to bus 1 on PMOD1
            intb (Pin, optional): Interrupt pin. Defaults to Pin.cpu.C6 on PMOD1
        """
        self.__SPI = spi_ic_interface(spi=SPI(spi, SPI.MASTER, baudrate=100000, polarity=0, phase=0), cs=cs)
        self.__SPI.__cs.high() #Set CS to idle high.
        
        #Initialize CRC flag
        self.crc_en = 0
        temp = self.read(self.MAX22007_CFG_adr)
        if temp[15] == '0':
            self.crc_en = 0
        else:
            self.crc_en = 1
Пример #5
0
    def __init__(self,
                 pin_cs=Pin.cpu.C0,
                 spi=1,
                 pin_fltr=Pin.cpu.A13,
                 pin_cmd=Pin.cpu.C1):
        FLTR = Pin(pin_fltr, Pin.OUT_PP)
        CMND = Pin(pin_cmd, Pin.OUT_PP)
        FLTR.high()
        CMND.high()
        self.__SPI = spi_ic_interface(spi=SPI(spi,
                                              SPI.MASTER,
                                              baudrate=5000,
                                              polarity=0,
                                              phase=0),
                                      cs=pin_cs)

        self.outputs = 0x00
        buf = self.build_byte_array(self.MAX14912_SET_OUT_STATE_CMD,
                                    "00000000")
        self.__SPI.send_recv(buf, buf)
Пример #6
0
 def __init__(self, cs = Pin.cpu.A4, spi= 1):
     Pin(cs).value(1)
     self.__SPI = spi_ic_interface(spi=SPI(spi, SPI.MASTER, baudrate=10000, polarity=0, phase=0), cs=cs)