Did I find the right examples for you? yes no

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)

        def unpack_bcd(x0):
    x00 = x0
    x = 0
    m = 0
    while x0:
        digit = x0 & 0x000f
        if digit>9:
            raise Exception("Non-BCD argument {:X} in {:X}".format(digit, x00))
        x = x + digit * 10**m
        m = m + 1
        x0 = x0 >> 4
    return x
        


src/s/c/schwinn810-HEAD/src/core/device.py   schwinn810(Download)
from serial import Serial, SerialException
from commands import *
from utils import unpack_bcd
import logging
# from collections import namedtuple
        id = "{0:s} {1:s} {2:s} {3:02d} {4:02d} {5:02d} {6:02d} {7:02d} {8:02d}" \
            .format(serial.decode('ascii'), v1.decode('ascii'), ee.decode('ascii'), \
                        e1, e2, e3, unpack_bcd(bcd1), unpack_bcd(bcd2), unpack_bcd(bcd3))
        _log.info("Found %s" % id)