コード例 #1
0
def _freeCounter(counterObj):
    hal.setCounterUpdateWhenEmpty(counterObj._counter, True)
    
    counterObj.clearUpSource()
    counterObj.clearDownSource()

    hal.freeCounter(counterObj._counter)

    counterObj.upSource = None
    counterObj.downSource = None
    counterObj._counter = None
コード例 #2
0
ファイル: counter.py プロジェクト: robotpy/robotpy-wpilib
    def setUpdateWhenEmpty(self, enabled: bool) -> None:
        """Select whether you want to continue updating the event timer
        output when there are no samples captured. The output of the event
        timer has a buffer of periods that are averaged and posted to a
        register on the FPGA. When the timer detects that the event source
        has stopped (based on the MaxPeriod) the buffer of samples to be
        averaged is emptied. If you enable update when empty, you will be
        notified of the stopped source and the event time will report 0
        samples. If you disable update when empty, the most recent average
        will remain on the output until a new sample is acquired. You will
        never see 0 samples output (except when there have been no events
        since an FPGA reset) and you will likely not see the stopped bit
        become true (since it is updated at the end of an average and
        there are no samples to average).

        :param enabled: True to continue updating
        """
        hal.setCounterUpdateWhenEmpty(self.counter, enabled)
コード例 #3
0
ファイル: counter.py プロジェクト: warrenlp/robotpy-wpilib
    def setUpdateWhenEmpty(self, enabled: bool) -> None:
        """Select whether you want to continue updating the event timer
        output when there are no samples captured. The output of the event
        timer has a buffer of periods that are averaged and posted to a
        register on the FPGA. When the timer detects that the event source
        has stopped (based on the MaxPeriod) the buffer of samples to be
        averaged is emptied. If you enable update when empty, you will be
        notified of the stopped source and the event time will report 0
        samples. If you disable update when empty, the most recent average
        will remain on the output until a new sample is acquired. You will
        never see 0 samples output (except when there have been no events
        since an FPGA reset) and you will likely not see the stopped bit
        become true (since it is updated at the end of an average and
        there are no samples to average).

        :param enabled: True to continue updating
        """
        hal.setCounterUpdateWhenEmpty(self.counter, enabled)
コード例 #4
0
ファイル: counter.py プロジェクト: arilotter/robotpy-wpilib
def _freeCounter(counter):
    hal.setCounterUpdateWhenEmpty(counter, True)
    hal.clearCounterUpSource(counter)
    hal.clearCounterDownSource(counter)
    hal.freeCounter(counter)
コード例 #5
0
def _freeCounter(counter):
    hal.setCounterUpdateWhenEmpty(counter, True)
    hal.clearCounterUpSource(counter)
    hal.clearCounterDownSource(counter)
    hal.freeCounter(counter)