Ejemplo n.º 1
0
 def __init__(self, pin=146):
     if not pin in self.VALID_PINS:
         raise Exception("Gpio: invalid pin:"+str(pin)+" not in "+str(self.VALID_PINS))
     self.pin = pin
     # mux pin, attaching gpio to the pin
     pydevmem.write(self.MUX_ADDR[pin], self.MUX_VAL[pin], self.MUX_MASK[pin])
     #pydevmem.write(self.muxRegs[self.pin], self.muxVals[self.pin], self.muxMasks[self.pin])
     # enable output
     pydevmem.write(self.OE_ADDR[pin], 0x00000000, self.BIT_MASK[pin])
     #pydevmem.write(self.oeReg[self.pin], 0x00000000, self.masks[self.pin])
     print "gpio created on pin",self.pin
Ejemplo n.º 2
0
 def __init__(self, pin=146):
     if not pin in self.VALID_PINS:
         raise Exception("Gpio: invalid pin:" + str(pin) + " not in " +
                         str(self.VALID_PINS))
     self.pin = pin
     # mux pin, attaching gpio to the pin
     pydevmem.write(self.MUX_ADDR[pin], self.MUX_VAL[pin],
                    self.MUX_MASK[pin])
     #pydevmem.write(self.muxRegs[self.pin], self.muxVals[self.pin], self.muxMasks[self.pin])
     # enable output
     pydevmem.write(self.OE_ADDR[pin], 0x00000000, self.BIT_MASK[pin])
     #pydevmem.write(self.oeReg[self.pin], 0x00000000, self.masks[self.pin])
     print "gpio created on pin", self.pin
Ejemplo n.º 3
0
 def __init__(self, pin=10):
     if not pin in self.VALID_PINS:
         raise Exception("invalid OmapPwm pin: "+str(pin)+" not in "+str(self.VALID_PINS))
     self.pin = pin
     # enable 32k clock for pin
     pydevmem.write(self.CLKSEL_ADDR[pin], 0xffffffff, self.CLKSEL_MASK[pin])
     # enable interface clock (ICLK)
     pydevmem.write(self.ICLKEN_ADDR[pin], 0xffffffff, self.ICLKEN_MASK[pin])
     # enable functional clock (FCLK)
     pydevmem.write(self.FCLKEN_ADDR[pin], 0xffffffff, self.FCLKEN_MASK[pin])
     # pause to allow changes to settle
     time.sleep(1)
     # disable timer (TCLR)
     pydevmem.write(self.TCLR_ADDR[pin], self.TCLR_OFF)
     # set mux (MUX)
     pydevmem.write(self.MUX_ADDR[pin], self.MUX_VAL[pin], self.MUX_MASK[pin])
Ejemplo n.º 4
0
 def __init__(self, pin=10):
     if not pin in self.VALID_PINS:
         raise Exception("invalid OmapPwm pin: " + str(pin) + " not in " +
                         str(self.VALID_PINS))
     self.pin = pin
     # enable 32k clock for pin
     pydevmem.write(self.CLKSEL_ADDR[pin], 0xffffffff,
                    self.CLKSEL_MASK[pin])
     # enable interface clock (ICLK)
     pydevmem.write(self.ICLKEN_ADDR[pin], 0xffffffff,
                    self.ICLKEN_MASK[pin])
     # enable functional clock (FCLK)
     pydevmem.write(self.FCLKEN_ADDR[pin], 0xffffffff,
                    self.FCLKEN_MASK[pin])
     # pause to allow changes to settle
     time.sleep(1)
     # disable timer (TCLR)
     pydevmem.write(self.TCLR_ADDR[pin], self.TCLR_OFF)
     # set mux (MUX)
     pydevmem.write(self.MUX_ADDR[pin], self.MUX_VAL[pin],
                    self.MUX_MASK[pin])
Ejemplo n.º 5
0
 def set_match(self, value):
     pydevmem.write(self.TMAR_ADDR[self.pin], value)
Ejemplo n.º 6
0
 def set_load(self, value):
     pydevmem.write(self.TLDR_ADDR[self.pin], value)
Ejemplo n.º 7
0
 def disable(self):
     pydevmem.write(self.TCLR_ADDR[self.pin], self.TCLR_OFF)
Ejemplo n.º 8
0
 def enable(self):
     # set the counter (CRR) to it's highest value, this makes the counter overflow
     # on the first clock cycle, bringing the output high
     pydevmem.write(self.TCRR_ADDR[self.pin], 0xffffffff)
     pydevmem.write(self.TCLR_ADDR[self.pin], self.TCLR_ON)
Ejemplo n.º 9
0
 def set_output(self, level):
     pydevmem.write(self.DATA_ADDR[self.pin], level,
                    self.BIT_MASK[self.pin])
     #pydevmem.write(self.dataOut[self.pin], level, self.masks[self.pin])
     print "set output to", level
Ejemplo n.º 10
0
 def set_output(self, level):
     pydevmem.write(self.DATA_ADDR[self.pin], level, self.BIT_MASK[self.pin])
     #pydevmem.write(self.dataOut[self.pin], level, self.masks[self.pin])
     print "set output to",level
Ejemplo n.º 11
0
 def set_match(self, value):
     pydevmem.write(self.TMAR_ADDR[self.pin], value)
Ejemplo n.º 12
0
 def set_load(self, value):
     pydevmem.write(self.TLDR_ADDR[self.pin], value)
Ejemplo n.º 13
0
 def disable(self):
     pydevmem.write(self.TCLR_ADDR[self.pin], self.TCLR_OFF)
Ejemplo n.º 14
0
 def enable(self):
     # set the counter (CRR) to it's highest value, this makes the counter overflow
     # on the first clock cycle, bringing the output high
     pydevmem.write(self.TCRR_ADDR[self.pin], 0xffffffff)
     pydevmem.write(self.TCLR_ADDR[self.pin], self.TCLR_ON)