Controls a blower.
More...
#include <blower.h>
Controls a blower.
Definition at line 27 of file blower.h.
◆ Blower() [1/2]
Default constructor.
Definition at line 24 of file blower.cpp.
◆ Blower() [2/2]
Blower::Blower |
( |
HardwareTimer * |
p_hardwareTimer, |
|
|
uint16_t |
p_timerChannel, |
|
|
uint16_t |
p_blowerPin |
|
) |
| |
Parameterized constructor.
- Parameters
-
p_hardwareTimer | Hardware time for the blower |
p_timerChannel | TIM channel for this blower |
p_blowerPin | Data pin for this blower |
Definition at line 26 of file blower.cpp.
HardwareTimer * actuator
Hardware timer used to control the blower.
bool m_stopped
Current state.
uint16_t m_targetSpeed
target speed
uint16_t timerChannel
Channel of the hardware timer used to control the blower.
uint16_t blowerPin
Pin of the blower.
uint16_t m_speed
Current speed.
◆ execute()
Definition at line 55 of file blower.cpp.
58 uint32_t currentDate = micros();
void runSpeed(uint16_t p_runSpeed)
Run the blower to a given speed.
◆ getBlowerPressure()
int32_t Blower::getBlowerPressure |
( |
int32_t |
p_flow | ) |
|
Given a flow in mL/min, return an estimated pressure just at the output of the blower.
This pressure has been determined using the pressure-flow characteristic of the blower
- Parameters
-
p_flow | inspiratory flow in mL/min |
Definition at line 85 of file blower.cpp.
91 703 - (281 * (p_flow / 100000)) - 832 * (p_flow / 200) * (p_flow / 500) / 100000;
95 - (281 * (p_flow / 100000)) - 832 * (p_flow / 200) * (p_flow / 500) / 100000;
98 return min(int32_t(703), max(returnValue, int32_t(0)));
◆ getSpeed()
uint16_t Blower::getSpeed |
( |
| ) |
const |
◆ getTargetSpeed()
uint16_t Blower::getTargetSpeed |
( |
| ) |
const |
Get target speed value.
Definition at line 103 of file blower.cpp.
◆ runSpeed()
void Blower::runSpeed |
( |
uint16_t |
p_runSpeed | ) |
|
Run the blower to a given speed.
- Parameters
-
p_runSpeed | Speed between MIN_BLOWER_SPEED and MAX_BLOWER_SPEED |
Definition at line 69 of file blower.cpp.
75 MICROSEC_COMPARE_FORMAT);
80 DBG_DO(Serial.print(
"Blower value is wrong: "));
81 DBG_DO(Serial.println(p_runSpeed));
#define BlowerSpeed2MicroSeconds(value)
Convert a speed to a value in microseconds for the blower controller.
#define DBG_DO(statement)
Expand arbitrary code only when in debug mode.
◆ runSpeedWithRampUp()
void Blower::runSpeedWithRampUp |
( |
uint16_t |
p_targetSpeed | ) |
|
Run the blower to a given speed applying a ramp-up to prevent high current drain.
- Parameters
-
p_targetSpeed | Speed between MIN_BLOWER_SPEED and MAX_BLOWER_SPEED |
Definition at line 44 of file blower.cpp.
◆ setup()
Initialize the hardware timer used to control the blower.
Definition at line 36 of file blower.cpp.
◆ stop()
◆ actuator
HardwareTimer* Blower::actuator |
|
private |
Hardware timer used to control the blower.
Definition at line 78 of file blower.h.
◆ blowerPin
uint16_t Blower::blowerPin |
|
private |
Pin of the blower.
Definition at line 84 of file blower.h.
◆ m_lastCallDate
uint32_t Blower::m_lastCallDate |
|
private |
◆ m_speed
Current speed.
Definition at line 87 of file blower.h.
◆ m_stopped
Current state.
Definition at line 93 of file blower.h.
◆ m_targetSpeed
uint16_t Blower::m_targetSpeed |
|
private |
target speed
Definition at line 90 of file blower.h.
◆ timerChannel
uint16_t Blower::timerChannel |
|
private |
Channel of the hardware timer used to control the blower.
Definition at line 81 of file blower.h.
The documentation for this class was generated from the following files: