def reg_to_alarms(reg_val):
    """Extracts Alarm flags from 32-bit register value.

    Parameters
    ----------
    reg_val : int
        32-bit TC1 register value

    Returns
    -------
    u32
        The alarm flags from the TC1.
        bit  0 = 1 if thermocouple connection is open-circuit;
        bit  1 = 1 if thermocouple connection is shorted to generated;
        bit  2 = 1 if thermocouple connection is shorted to VCC;
        bit 16 = 1 if any if bits 0-2 are 1.

    """
    return reg_val & 65551
