/** * Pop error from queue * @param context - scpi context * @param error * @return */ scpi_bool_t SCPI_ErrorPop(scpi_t * context, scpi_error_t * error) { if (!error || !context) return FALSE; SCPI_ERROR_SETVAL(error, 0, NULL); fifo_remove(&context->error_queue, error); SCPI_ErrorEmitEmpty(context); return TRUE; }
/** * Pop error from queue * @param context - scpi context * @return error number */ int16_t SCPI_ErrorPop(scpi_t * context) { int16_t result = 0; fifo_remove(&context->error_queue, &result); SCPI_ErrorEmitEmpty(context); return result; }
/** * Clear error queue * @param context - scpi context */ void SCPI_ErrorClear(scpi_t * context) { #if USE_DEVICE_DEPENDENT_ERROR_INFORMATION scpi_error_t error; while (fifo_remove(&context->error_queue, &error)) { SCPIDEFINE_free(&context->error_info_heap, error.device_dependent_info, false); } #endif fifo_clear(&context->error_queue); SCPI_ErrorEmitEmpty(context); }
/** * Clear error queue * @param context - scpi context */ void SCPI_ErrorClear(scpi_t * context) { /* * // FreeRTOS * xQueueReset((xQueueHandle)context->error_queue); */ /* basic FIFO */ fifo_clear((scpi_fifo_t *) context->error_queue); SCPI_ErrorEmitEmpty(context); }
/** * Pop error from queue * @param context - scpi context * @return error number */ INT16 SCPI_ErrorPop(scpi_t * context) { INT16 result = 0; /* * // FreeRTOS * if (pdFALSE == xQueueReceive((xQueueHandle)context->error_queue, &result, 0)) { * result = 0; * } */ /* basic FIFO */ fifo_remove((scpi_fifo_t *) context->error_queue, &result); SCPI_ErrorEmitEmpty(context); return result; }
/** * Clear error queue * @param context - scpi context */ void SCPI_ErrorClear(scpi_t * context) { fifo_clear(&context->error_queue); SCPI_ErrorEmitEmpty(context); }