Example #1
0
 def read(self):
     return SPIADC.read(self.ch_port)
Example #2
0
 def read(self):
     return SPIADC.read(self.ch_port)
Example #3
0
    def __init__(self, ch_port):
        super(IWrite, self).__init__(ch_port)
        self.last_written_value = self.DEFAULT_VALUE

    def read(self):
        """
        By default returns the last written state, If no write calls have been made
        it returns the value set by DEFAULT_VALUE
        """
        return self.last_written_value

    def write(self, value):
        self.last_written_value = value


SPIADC.setup(0, 100000)


class ADC(IRead):
    """
    Maps to ADC using library
    Read only implied
    """
    IO_TYPE = IBase.IO_TYPE_INTEGER
    # we're using an 8 channel ADC
    IO_CHOICES = (
        (0, 'CH0'),
        (1, 'CH1'),
        (2, 'CH2'),
        (3, 'CH3'),
        (4, 'CH4'),
Example #4
0
    def __init__(self, ch_port):
        super(IWrite, self).__init__(ch_port)
        self.last_written_value = self.DEFAULT_VALUE

    def read(self):
        """
        By default returns the last written state, If no write calls have been made
        it returns the value set by DEFAULT_VALUE
        """
        return self.last_written_value

    def write(self, value):
        self.last_written_value = value

try:
    SPIADC.setup(0, 100000)
    adcactive = True
 
    class ADC(IRead):
        """
        Maps to ADC using library
        Read only implied
        """
        IO_TYPE = IBase.IO_TYPE_INTEGER
        # we're using an 8 channel ADC
        IO_CHOICES = (
            (0, 'CH0'),
            (1, 'CH1'),
            (2, 'CH2'),
            (3, 'CH3'),
            (4, 'CH4'),