/* Reflow Oven Controller * * Copyright (C) 2020 Mario Hüttel * * This file is part of the Reflow Oven Controller Project. * * The reflow oven controller is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * The Reflow Oven Control Firmware is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the reflow oven controller project. * If not, see . */ /** * @addtogroup safety-controller * @{ */ #ifndef __SAFETY_CONTROLLER_H__ #define __SAFETY_CONTROLLER_H__ #include #include #include enum analog_monitor_status {ANALOG_MONITOR_OK = 0, ANALOG_MONITOR_ERROR, ANALOG_MONITOR_INACTIVE, ANALOG_MONITOR_OVER, ANALOG_MONITOR_UNDER}; /** * @brief Initialize the safety controller * * After a call to this function the controller is iniotlaized and the watchdog is set up. * You have to call safety_controller_handle * If this function fails, it will hang, because errors in the safety controller are not recoverable */ void safety_controller_init(); /** * @brief Handle the safety controller. * @note This function must be executed periodically in order to prevent the watchdog from resetting the firmware * @return 0 if successful */ int safety_controller_handle(); int safety_controller_report_error(enum safety_flag flag); int safety_controller_report_error_with_key(enum safety_flag flag, uint32_t key); void safety_controller_report_timing(enum timing_monitor monitor); void safety_controller_report_analog_value(enum analog_value_monitor monitor, float value); int safety_controller_enable_timing_mon(enum timing_monitor monitor, bool enable); enum analog_monitor_status safety_controller_get_analog_mon_value(enum analog_value_monitor monitor, float *value); int safety_controller_get_flag(enum safety_flag flag, bool *status, bool try_ack); int safety_controller_ack_flag(enum safety_flag flag); int safety_controller_ack_flag_with_key(enum safety_flag flag, uint32_t key); bool safety_controller_get_flags_by_mask(enum safety_flag mask); #endif /* __SAFETY_CONTROLLER_H__ */ /** @} */