Vehicle Control Unit
0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Core
Src
Systems
Monitors
BrakePolice.c
Go to the documentation of this file.
1
#include "../../../Inc/Systems/Monitor/BrakePolice.h"
2
#include "../../../Inc/Utils/Common.h"
3
4
// Make new BrakePolice MonitorSystem
5
void
initBrakePolice
(
BrakePolice
* bp,
BrakeSystemControl
*bsc,
int
hz,
int
maxTemp) {
6
initMonitorSystem
(&bp->
base
,
"Brake Police"
, hz,
m_BRAKES
,
VEHICLE_SHUTDOWN
,
checkBrakePolice
);
7
bp->
bsc
= bsc;
8
bp->
maxTemperatureAllowed
= maxTemp;
9
bp->
status
=
BRAKES_OK
;
10
}
11
12
// Start the BrakePolice MonitorSystem
13
int
startBrakePolice
(
BrakePolice
* bp) {
14
if
(bp->
base
.
runMonitor
== NULL) {
15
printf(
"Monitor function not set for BrakePolice\n"
);
16
return
_FAILURE
;
17
}
18
ENABLE
(bp->
base
.
system
);
19
return
_SUCCESS
;
20
}
21
22
// Check the BrakePolice MonitorSystem
23
int
checkBrakePolice
(
void
* bp) {
24
BrakePolice
* bpPtr = (
BrakePolice
*)bp;
25
BrakeSystemControl
* bsc = bpPtr->
bsc
;
26
bsc->
status
=
checkSensorLimits
(bsc);
27
if
(bsc->
status
!=
BRAKES_OK
) {
28
return
_FAILURE
;
29
}
30
31
return
_SUCCESS
;
32
}
startBrakePolice
int startBrakePolice(BrakePolice *bp)
Definition:
BrakePolice.c:13
initBrakePolice
void initBrakePolice(BrakePolice *bp, BrakeSystemControl *bsc, int hz, int maxTemp)
Definition:
BrakePolice.c:5
checkBrakePolice
int checkBrakePolice(void *bp)
Definition:
BrakePolice.c:23
BRAKES_OK
@ BRAKES_OK
Definition:
BrakeSystemControl.h:10
checkSensorLimits
BrakeSystemStatus checkSensorLimits(BrakeSystemControl *bsc)
Checks if the brake system is within the defined limits and desired ranges.
Definition:
BrakeSystemControl.c:95
_FAILURE
#define _FAILURE
Definition:
Common.h:6
_SUCCESS
#define _SUCCESS
Definition:
Common.h:5
initMonitorSystem
void initMonitorSystem(MonitorSystem *monitor, const char *name, int hz, MonitorType type, FaultType fault, int(*runMonitor)(void *self))
Initializes the Monitor System with initial settings.
Definition:
MonitorSystem.c:3
m_BRAKES
@ m_BRAKES
Definition:
MonitorSystem.h:13
VEHICLE_SHUTDOWN
@ VEHICLE_SHUTDOWN
Definition:
MonitorSystem.h:23
ENABLE
#define ENABLE(item_)
Definition:
Updateable.h:10
BrakePolice
Definition:
BrakePolice.h:7
BrakePolice::status
BrakeSystemStatus status
Definition:
BrakePolice.h:10
BrakePolice::base
MonitorSystem base
Definition:
BrakePolice.h:8
BrakePolice::bsc
BrakeSystemControl * bsc
Definition:
BrakePolice.h:11
BrakePolice::maxTemperatureAllowed
int maxTemperatureAllowed
Definition:
BrakePolice.h:9
BrakeSystemControl
Definition:
BrakeSystemControl.h:18
BrakeSystemControl::status
BrakeSystemStatus status
Definition:
BrakeSystemControl.h:26
MonitorSystem::runMonitor
int(* runMonitor)(void *self)
Definition:
MonitorSystem.h:30
MonitorSystem::system
System system
Definition:
MonitorSystem.h:27
Generated by
1.9.5