## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
import sigrokdecode as srd
pass
class Decoder(srd.Decoder):
- api_version = 2
+ api_version = 3
id = 'stepper_motor'
name = 'Stepper motor'
longname = 'Stepper motor position / speed'
if key == srd.SRD_CONF_SAMPLERATE:
self.samplerate = value
- def decode(self, ss, es, data):
+ def decode(self):
if not self.samplerate:
raise SamplerateError('Cannot decode without samplerate.')
-
- for (self.samplenum, (step, direction)) in data:
- if step == 1 and self.oldstep == 0:
- self.step(self.samplenum, direction)
- self.oldstep = step
+ while True:
+ step, direction = self.wait({0: 'r'})
+ self.step(self.samplenum, direction)