/**** Includes ****/ #include "../utils/utils.h" #include "cv_output.h" using namespace hw; /**** Private definitions ****/ /**** Private constants ****/ /**** Private variables ****/ /**** Private function declarations ****/ /**** Public function definitions ****/ hw::CVoutput::CVoutput(bsp::Hafbridge* hbridge, bsp::AnalogIn* supply_u) { this->hbridge = hbridge; this->supply = supply_u; this->target = 0; this->min_out = 0; this->hbridge->disable(); } hw::CVoutput::~CVoutput(void) { this->hbridge->write((uint16_t)0x0000); this->hbridge->disable(); return; } void hw::CVoutput::update(void) { // Check target if((this->target < this->min_out)&&(this->target > 0)) this->target = this->min_out; // Set output this->hbridge->write(util::sat_ratio(this->target, this->supply->last_read)); } void hw::CVoutput::enable(void) { this->hbridge->enable(); } void hw::CVoutput::disable(void) { this->hbridge->disable(); } uint8_t hw::CVoutput::is_enabled(void) { return this->hbridge->is_enabled(); } /**** Private function definitions ****/