Skip to content

Commit 0fafb36

Browse files
committed
add get_vent_fault
1 parent cfc2e66 commit 0fafb36

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

stm32-modules/include/vacuum-module/firmware/vent_hardware.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern "C" {
1212

1313
void vent_hardware_init(void);
1414
void hw_open_vent(bool open);
15+
bool hw_vent_fault_detected();
1516

1617
#ifdef __cplusplus
1718
} // extern "C"

stm32-modules/include/vacuum-module/firmware/vent_policy.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ namespace vent_policy {
77
class VentPolicy {
88
public:
99
auto open_vent(bool open) -> void;
10+
auto get_vent_fault() -> bool;
1011
};
1112
} // namespace vent_policy

stm32-modules/vacuum-module/firmware/vent/vent_hardware.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ void hw_open_vent(bool open) {
4444
HAL_GPIO_WritePin(nSLEEP_DRV_MCU_GPIO_Port, nSLEEP_DRV_MCU_GPIO_Pin, open ? GPIO_PIN_RESET : GPIO_PIN_SET);
4545
}
4646

47+
bool hw_vent_fault_detected() {
48+
return HAL_GPIO_ReadPin(VENT_FAULT_GPIO_Port, VENT_FAULT_GPIO_Pin);
49+
}
50+
4751
void vent_hardware_init(void) {
4852
vent_hardware_gpio_init();
4953
// close the vent

stm32-modules/vacuum-module/firmware/vent/vent_policy.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
using namespace vent_policy;
66

77
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
8-
auto VentPolicy::open_vent(bool open) -> void { hw_open_vent(open); }
8+
auto vent_policy::VentPolicy::open_vent(bool open) -> void { hw_open_vent(open); }
9+
10+
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
11+
auto vent_policy::VentPolicy::get_vent_fault() -> bool { return hw_vent_fault_detected(); }

0 commit comments

Comments
 (0)