예제 #1
0
파일: pd.py 프로젝트: cmumford/RTClib
    0b11: '8kHz',
}

DS3231_I2C_ADDRESS = 0x68


def regs_and_bits():
    l = [('reg_' + r.lower(), r + ' register') for r in regs]
    l += [('bit_' + re.sub(r'\/| ', '_', b).lower(), b + ' bit') for b in bits]
    return tuple(l)


a = ['REG_' + r.upper() for r in regs] + \
    ['BIT_' + re.sub('\/| ', '_', b).upper() for b in bits] + \
    ['READ_DATE_TIME', 'WRITE_DATE_TIME', 'READ_REG', 'WRITE_REG', 'WARNING']
Ann = SrdIntEnum.from_list('Ann', a)


class DateTime(object):
    days_of_week = (
        'Sunday',
        'Monday',
        'Tuesday',
        'Wednesday',
        'Thursday',
        'Friday',
        'Saturday',
    )

    def __init__(self):
        self.hours = -1
예제 #2
0
파일: pd.py 프로젝트: zyp/libsigrokdecode
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.
##

import sigrokdecode as srd
from math import ceil
from common.srdhelper import SrdIntEnum
from .lists import *

L = len(cmds)
RX = 0
TX = 1

Ann = SrdIntEnum.from_list('Ann',
                           [c[0]
                            for c in cmds.values()] + ['BIT', 'FIELD', 'WARN'])


def cmd_annotation_classes():
    return tuple([tuple([cmd[0].lower(), cmd[1]]) for cmd in cmds.values()])


class Decoder(srd.Decoder):
    api_version = 3
    id = 'amulet_ascii'
    name = 'Amulet ASCII'
    longname = 'Amulet LCD ASCII'
    desc = 'Amulet Technologies LCD controller ASCII protocol.'
    license = 'gplv3+'
    inputs = ['uart']