CARD_NAME = "Flagstaff-Research"
VERSION = "1.0.0"

SLAVE_OWN_ADDRESS_BASE = 0x0c
STACK_LEVEL_MAX = 7

CALIBRATION_KEY = 0xaa
RESET_CALIBRATION_KEY  = 0x55
WDT_RESET_SIGNATURE     = 0xca
WDT_RESET_COUNT_SIGNATURE    = 0xbe

VOLT_TO_MILIVOLT = 1000
MILIAMPER_TO_MICROAMPER = 1000

class I2C_MEM:
    FETS = 0
    FET_SET = 1
    FET_CLR = 2
    DIGI = 3

    U10_OUT = 4
    PUMP = 8

    U5_IN = 16
    RTD_TEMP = 40
    RTD_RES = 52

    CALIB_VALUE = 64
    CALIB_CHANNEL = 68
    CALIB_KEY = 69
    CALIB_STATUS = 70
    MODBUS_SETINGS = 71
    NBS1 = 72
    MBS2 = 73
    MBS3 = 74
    MODBUS_ID_OFFSET = 75
    RTC_YEAR = 76
    RTC_MONTH = 77
    RTC_DAY = 78
    RTC_HOUR = 79
    RTC_MINUTE = 80
    RTC_SECOND = 81
    RTC_SET_YEAR = 82
    RTC_SET_MONTH = 83
    RTC_SET_DAY = 84
    RTC_SET_HOUR = 85
    RTC_SET_MINUTE = 86
    RTC_SET_SECOND = 87
    RTC_CMD = 88
    WDT_RESET = 89
    WDT_INTERVAL_SET = 90
    WDT_INTERVAL_GET = 92
    WDT_INIT_INTERVAL_SET = 94
    WDT_INIT_INTERVAL_GET = 96
    WDT_RESET_COUNT = 98
    WDT_CLEAR_RESET_COUNT = 100
    WDT_POWER_OFF_INTERVAL_SET = 101
    WDT_POWER_OFF_INTERVAL_GET = 105
    DIGI_RISING = 109
    DIGI_FALLING = 110
    DIGI_COUNT_RST = 111
    DIGI_COUNT = 112

    OWB_DEV = 128
    OWB_TEMP_ALL = 129
    OWB_ROM_CODE_IDX = 131
    OWB_ROM_CODE = 132
    OWB_START_SEARCH = 140
    OWB_TEMP = 141

    CPU_RESET = 0xaa
    PUMP_PWM_PRESCALER = 0xab
    REVISION_MAJOR = 253
    REVISION_MINOR = 254
    SLAVE_BUFF_SIZE = 255

CHANNEL_NO = {
    "u5_in": 12,
    "u10_out": 2,
    "pump": 4,
    "fet": 8,
    "digi": 4,
    "owb": 14,
    "rtd": 3,
}
