First draft of safety controller

This commit is contained in:
2020-07-27 21:29:15 +02:00
parent a04e894518
commit 4f3016649d
6 changed files with 41 additions and 8 deletions

View File

@@ -34,6 +34,7 @@ enum safety_flag {
ERR_FLAG_STACK = (1<<8),
ERR_FLAG_SAFETY_ADC = (1<<9),
ERR_FLAG_SYSTICK = (1<<10),
ERR_FLAG_WTCHDG_FIRED = (1<<11),
};
enum timing_monitor {

View File

@@ -29,6 +29,7 @@
#include <reflow-controller/safety/safety-config.h>
#include <stdbool.h>
#include <stdint.h>
enum analog_monitor_status {ANALOG_MONITOR_OK = 0,
ANALOG_MONITOR_ERROR,
@@ -66,6 +67,8 @@ 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);
#endif /* __SAFETY_CONTROLLER_H__ */
/** @} */

View File

@@ -23,6 +23,7 @@
#include <reflow-controller/safety/safety-config.h>
#include <stdint.h>
#include <stdbool.h>
/**
* @brief Setup the watchdog for the safety controller
@@ -39,5 +40,11 @@ int watchdog_setup(uint8_t prescaler);
*/
int watchdog_ack(uint32_t magic);
/**
* @brief Check if reset was generated by the watchdog.
* @note This also clears the relevant flag, so the function will reutrn false when called a second time
* @return
*/
bool watchdog_check_reset_source(void);
#endif /* __WATCHDOG_H__ */