First draft of safety controller
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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__ */
 | 
			
		||||
 | 
			
		||||
/** @} */
 | 
			
		||||
 
 | 
			
		||||
@@ -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__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -64,5 +64,4 @@ int rcc_manager_enable_clock(volatile uint32_t *rcc_enable_register, uint8_t bit
 | 
			
		||||
 */
 | 
			
		||||
int rcc_manager_disable_clock(volatile uint32_t *rcc_enable_register, uint8_t bit_no);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif /* __CLOCK_ENABLE_MANAGER_H__ */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user