/* Is called after a "threshold exceeded" interrupt occurred. Checks the sensor's status register for the limit exceeded flags and calls the trigger handler if one of the flags is set.  */
static void tids_process_threshold_interrupt(const struct device *dev)
/* Is called after a "threshold exceeded" interrupt occurred. Checks the sensor's status register for the limit exceeded flags and calls the trigger handler if one of the flags is set.  */
static void tids_process_threshold_interrupt(const struct device *dev)
{
	struct tids_data *data = dev->data;
	TIDS_status_t status;
	if (TIDS_getStatusRegister(&data->sensor_interface, &status) != WE_SUCCESS) {
		LOG_ERR("Failed to read status register");
		return;
	}
	if (data->threshold_handler != NULL &&
	    (status.upperLimitExceeded != 0 || status.lowerLimitExceeded != 0)) {
		data->threshold_handler(dev, data->threshold_trigger);
	}
	if (data->threshold_handler != NULL) {
		tids_setup_threshold_interrupt(dev, true);
	}
}