code: async def set_digital_latch(self, pin, threshold_value, cb=None,
                                  cb_type=None):
          
          if 0 <= threshold_value <= 1:
              key = 'D' + str(pin)
              self.latch_map[key] = [Constants.LATCH_ARMED, Constants.LATCH_EQ,
                                     threshold_value, 0, 0, cb, cb_type]
              return True
          else:
              return False
docs: This method "arms" a digital pin for its data to be latched and
          saved in the latching table
          If a callback method is provided, when latching criteria is achieved,
          the callback function is called with latching data notification.
  
          Data returned in the callback list has the pin number as the
          first element,
  
          :param pin: Digital pin number
  
          :param threshold_value: 0 or 1
  
          :param cb: callback function
  
          :param cb_type: Constants.CB_TYPE_DIRECT = direct call or
                          Constants.CB_TYPE_ASYNCIO = asyncio coroutine
  
          :returns: True if successful, False if parameter data is invalid