def disable(self): ''' disable() Turns the eQEP hardware OFF ''' enable_file = "%s/enabled" % self.base_dir return sysfs.kernelFilenameIO(enable_file, 0)
def getMode(self): ''' getMode() Returns the mode the eQEP hardware is in. ''' mode_file = "%s/mode" % self.base_dir return sysfs.kernelFilenameIO(mode_file)
def setFrequency(self,freq): ''' setFrequency(freq) Set the frequency in Hz at which the driver reports new positions. ''' period_file = "%s/period" % self.base_dir return sysfs.kernelFilenameIO(period_file,1000000000/freq)
def setPosition(self,val): ''' setPosition(value) Give a new value to the current position ''' position_file = "%s/position" % self.base_dir return sysfs.kernelFilenameIO(position_file,val)
def setFrequency(self, freq): ''' setFrequency(freq) Set the frequency in Hz at which the driver reports new positions. ''' period_file = "%s/period" % self.base_dir return sysfs.kernelFilenameIO(period_file, 1000000000 / freq)
def setPosition(self, val): ''' setPosition(value) Give a new value to the current position ''' position_file = "%s/position" % self.base_dir return sysfs.kernelFilenameIO(position_file, val)
def setRelative(self): ''' setRelative() Set mode as Relative The position is reset when the unit timer overflows. ''' mode_file = "%s/mode" % self.base_dir return sysfs.kernelFilenameIO(mode_file, 1)
def setAbsolute(self): ''' setAbsolute() Set mode as Absolute The position starts at zero and is incremented or decremented by the encoder's movement ''' mode_file = "%s/mode" % self.base_dir return sysfs.kernelFilenameIO(mode_file, 0)
def getPosition(self): ''' getPosition() Get the current position of the encoder. In absolute mode, this attribute represents the current position of the encoder. In relative mode, this attribute represents the position of the encoder at the last unit timer overflow. ''' position_file = "%s/position" % self.base_dir return sysfs.kernelFilenameIO(position_file)