index = 0
class AnalogInput(ReadonlyRegisterBase):
    def doRead(self):
        global index
        index = index+1
        if index<5: 
            return None
        return sin.read()

class Waveform(ReadonlyRegisterBase, ReadonlyRegisterArray):
    def doRead(self):
        global index
        index = index+1
        if index<5: 
            return None
        return arr.read()

    def getSize(self):
        return arr.size 

class Image(ReadonlyRegisterBase, ReadonlyRegisterMatrix):
    def doRead(self):
        global index
        index = index+1
        if index<5: 
            return None
        return matrix.read()

    def getWidth(self):
         return matrix.width

    def getHeight(self):
         return matrix.height 

add_device(AnalogInput("tst"), True)
add_device(Waveform("tst2"), True)
add_device(Image("tst3"), True)

tscan(tst3, 10, 0.1)