Exemple #1
0
    def __init__(self):

        self.red = Pwm(self.gpioRed)
        self.green = Pwm(self.gpioGreen)
        self.blue = Pwm(self.gpioBlue)

        # Time between each fade step
        self.fadeTickSeconds = 1
Exemple #2
0
    def elaborate(self, platform):
        platform.add_resources([
            Resource("speaker", 0, Pins("1 2", dir='o', conn=("j", "1")),
                     Attrs(IO_TYPE="LVCMOS33"))
        ])
        speaker = platform.request("speaker", 0)
        led = platform.request("led", 0)

        m = Module()

        pll = m.submodules.pll = Pll(25e6, 20, 1, reset_less_input=True)
        pll.output_domain("eth", 4)

        os.environ["NMIGEN_nextpnr_opts"] = "--timing-allow-fail"
        eth = m.submodules.eth = DomainRenamer("eth")(LiteEth(
            platform.request(
                "eth",
                0,
                dir={io.name: "-"
                     for io in platform.lookup("eth", 0).ios}),
            platform.request("eth_clocks",
                             0,
                             dir={
                                 io.name: "-"
                                 for io in platform.lookup("eth_clocks", 0).ios
                             })))

        pwm = m.submodules.pwm = Pwm(0)
        m.d.comb += speaker.o[0].eq(pwm.output)
        m.d.comb += speaker.o[1].eq(~pwm.output)

        m.submodules.clocking_i2s = ClockDebug("eth")
        m.submodules.clocking_sync = ClockDebug("sync", reset_less=True)

        return m
Exemple #3
0
    def __init__(self, port, stopDelay=0):
        '''
        Constructor
        
        @param port: PWM port where the buzzer is connected to
        @param stopDelay: Delay in seconds to separate notes
        '''

        self._stopDelay = stopDelay
        self._pwm = Pwm(port)
Exemple #4
0
 def __init__(self, port):
     '''
     Constructor.
     Inits servo to neutral value, but a different value can be set after construtor call.
     
     @param port: PWM port the server is connected to
     '''
     
     self._pwm = Pwm(port)
     self._pwm.setPeriod(Servo.PERIOD)
     self._pwm.setDuty(Servo.NEUTRAL_DUTY)
Exemple #5
0
 def __init__(self, pwm_pin):
     self.pwm = Pwm(pwm_pin, 50)
     self.direction = 0
     self.position = 0  # for stepper motor
Exemple #6
0
 def __init__(self):
     Pyro.core.ObjBase.__init__(self)
     self.adc = Adc()  #adc.Adc()
     self.pwm = Pwm()  #pwm.OmapPwm()
     self.gpio = Gpio()  #gpio.Gpio()