mirror of https://github.com/rusefi/wideband.git
api to get pump duty
This commit is contained in:
parent
2d5d6a0026
commit
fb66c03ac7
|
@ -36,3 +36,8 @@ void SetPumpCurrentTarget(int32_t microampere)
|
|||
|
||||
pumpDac.SetDuty(volts / VCC_VOLTS);
|
||||
}
|
||||
|
||||
uint16_t GetPumpOutputDuty()
|
||||
{
|
||||
return pumpDac.GetLastDuty();
|
||||
}
|
||||
|
|
|
@ -4,3 +4,4 @@
|
|||
|
||||
void InitPumpDac();
|
||||
void SetPumpCurrentTarget(int32_t microamperes);
|
||||
uint16_t GetPumpOutputDuty();
|
||||
|
|
|
@ -45,5 +45,12 @@ float clampF(float min, float clamp, float max) {
|
|||
void Pwm::SetDuty(float duty) {
|
||||
pwmcnt_t highTime = m_counterPeriod * clampF(0, duty, 1);
|
||||
|
||||
m_lastDuty = highTime;
|
||||
|
||||
pwm_lld_enable_channel(m_driver, m_channel, highTime);
|
||||
}
|
||||
|
||||
uint16_t Pwm::GetLastDuty() const
|
||||
{
|
||||
return m_lastDuty;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,11 @@ public:
|
|||
|
||||
void Start();
|
||||
void SetDuty(float duty);
|
||||
uint16_t GetLastDuty() const;
|
||||
private:
|
||||
PWMDriver* const m_driver;
|
||||
const uint8_t m_channel;
|
||||
const uint32_t m_counterFrequency;
|
||||
const uint16_t m_counterPeriod;
|
||||
uint16_t m_lastDuty;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue