<commit_before>"""
Created on 12 Jun 2019

@author: <NAME> (<EMAIL>)

https://github.com/south-coast-science/scs_rpz_header_t1_f1
"""

import time

from scs_core.data.datum import Decode

from scs_host.bus.i2c import I2C
from scs_host.lock.lock import Lock


# --------------------------------------------------------------------------------------------------------------------

class RPzHeaderT1F1(object):
    """
    Constructor
    """

    DEFAULT_ADDR =          0x76


    # ----------------------------------------------------------------------------------------------------------------

    __RESPONSE_ACK =        1
    __RESPONSE_NACK =       2

    __SEND_WAIT_TIME =      0.001               # seconds
    __LOCK_TIMEOUT =        2.0                 # seconds


    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, addr):
        """
        Constructor
        """
        self.__addr = addr


    # ----------------------------------------------------------------------------------------------------------------

    def host_shutdown_initiated(self):
        self.__cmd(ord('s'), 0)


    def button_enable(self):
        self.__cmd(ord('e'), 0)

<commit_msg>Fixed zero-length I2C read issue.<commit_after>"""
Created on 12 Jun 2019

@author: <NAME> (<EMAIL>)

https://github.com/south-coast-science/scs_rpz_header_t1_f1
"""

import time

from scs_core.data.datum import Decode

from scs_host.bus.i2c import I2C
from scs_host.lock.lock import Lock


# --------------------------------------------------------------------------------------------------------------------

class RPzHeaderT1F1(object):
    """
    Constructor
    """

    DEFAULT_ADDR =          0x76

    # ----------------------------------------------------------------------------------------------------------------

    __RESPONSE_ACK =        1
    __RESPONSE_NACK =       2

    __SEND_WAIT_TIME =      0.000               # seconds
    __LOCK_TIMEOUT =        2.0                 # seconds


    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, addr):
        """
        Constructor
        """
        self.__addr = addr


    # ----------------------------------------------------------------------------------------------------------------

    def host_shutdown_initiated(self):
        self.__cmd(ord('s'), 0)


    def button_enable(self):
        self.__cmd(ord('e'), 0)


{'fraction_non_alphanumeric': 0.4236955668889761, 'fraction_numerical': 0.02000784621420165, 'mean_word_length': 0.7299864314789688, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1543417', 'n_tokens_mistral': 634, 'n_tokens_neox': 575, 'n_words': 110}