X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Frtc8564%2Fpd.py;h=25eb4e7d7aa85c7c5b6c06144fffa5c4980ae981;hp=24a68fbe28da6f50c8d30f4a57ddf1de8f0e8d9f;hb=d6d8a8a440ea2a81e6ddde33d16bc84d01cdb432;hpb=486b19ce017c6663be6574dacd0c823304903bca diff --git a/decoders/rtc8564/pd.py b/decoders/rtc8564/pd.py index 24a68fb..25eb4e7 100644 --- a/decoders/rtc8564/pd.py +++ b/decoders/rtc8564/pd.py @@ -14,15 +14,11 @@ ## 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 . ## import sigrokdecode as srd - -# Return the specified BCD number (max. 8 bits) as integer. -def bcd2int(b): - return (b & 0x0f) + ((b >> 4) * 10) +from common.srdhelper import bcd2int def reg_list(): l = [] @@ -32,7 +28,7 @@ def reg_list(): return tuple(l) class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'rtc8564' name = 'RTC-8564' longname = 'Epson RTC-8564 JE/NB' @@ -40,6 +36,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['i2c'] outputs = ['rtc8564'] + tags = ['Clock/timing'] annotations = reg_list() + ( ('read', 'Read date/time'), ('write', 'Write date/time'), @@ -55,7 +52,10 @@ class Decoder(srd.Decoder): ('date-time', 'Date/time', (9, 10)), ) - def __init__(self, **kwargs): + def __init__(self): + self.reset() + + def reset(self): self.state = 'IDLE' self.hours = -1 self.minutes = -1