MCU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
SafetySystem Class Reference

#include <SafetySystem.h>

Collaboration diagram for SafetySystem:
Collaboration graph

Public Member Functions

 SafetySystem (AMSInterface *ams, WatchdogInterface *wd)
 
void init ()
 
void software_shutdown (const SysTick_s &tick)
 
bool get_software_is_ok ()
 

Private Attributes

AMSInterfaceams_
 
WatchdogInterfacewd_
 
bool software_is_ok
 

Detailed Description

Definition at line 8 of file SafetySystem.h.

Constructor & Destructor Documentation

◆ SafetySystem()

SafetySystem::SafetySystem ( AMSInterface ams,
WatchdogInterface wd 
)
inline

Definition at line 11 of file SafetySystem.h.

11 :
12 ams_(ams),
13 wd_(wd){};
WatchdogInterface * wd_
Definition: SafetySystem.h:29
AMSInterface * ams_
Definition: SafetySystem.h:28

Member Function Documentation

◆ get_software_is_ok()

bool SafetySystem::get_software_is_ok ( )

Definition at line 37 of file SafetySystem.cpp.

37 {
38 return software_is_ok;
39}
bool software_is_ok
Definition: SafetySystem.h:32

◆ init()

void SafetySystem::init ( )

Definition at line 7 of file SafetySystem.cpp.

7 {
8 // Initialize interface output
11 // Initial state is ok
12 software_is_ok = true;
13}
void set_start_state()

◆ software_shutdown()

void SafetySystem::software_shutdown ( const SysTick_s &  tick)

Definition at line 16 of file SafetySystem.cpp.

16 {
17 software_is_ok = true;
18
19 // If AMS heartbeat is not received within reasonable interval
20 // Set software is not ok
21 if (!ams_->heartbeat_received(tick.millis)) {
22 // Serial.println("heartbeat not received");
23 software_is_ok = false;
24 }
25 if (software_is_ok) {
27 }
28 else {
29 ams_->set_state_ok_high(false);
30 }
31
32 // Kick watchdog every software cycle
33 wd_->kick_watchdog(tick.millis);
34}
bool heartbeat_received(unsigned long curr_millis)
void set_state_ok_high(bool ok_high)
void kick_watchdog(unsigned long curr_millis)

Member Data Documentation

◆ ams_

AMSInterface* SafetySystem::ams_
private

Definition at line 28 of file SafetySystem.h.

◆ software_is_ok

bool SafetySystem::software_is_ok
private

Definition at line 32 of file SafetySystem.h.

◆ wd_

WatchdogInterface* SafetySystem::wd_
private

Definition at line 29 of file SafetySystem.h.


The documentation for this class was generated from the following files: