peary::board::carboard::CurrentSource

Current source resource for CaR board.

#include <peary/hardware/boards/Carboard.hpp>

Inherits from peary::hal::CurrentControl, peary::hal::SwitchControl, peary::hal::Resource

Public Functions

Name
CurrentSource(component::DAC7678 & dac, component::DAC7678::Channel dac_channel, component::PCA9539 & pca, component::PCA9539::Port pca_port, component::PCA9539::Channel pca_channel)Constructor for CurrentSource class.
virtual void setCurrent(double current) overrideSet the output current for the current source.
virtual void setSwitch(bool enable) overrideEnable or disable the output of the current source.
virtual void setPolarity(utils::Polarity polarity) overrideSet the polarity of the current source.

Additional inherited members

Public Functions inherited from peary::hal::Resource

Name
virtual ~Resource() =defaultDefault constructor.
void setName(const std::string & name)Set the name of the resource.
std::string name() constGet the name of the resource.

Protected Attributes inherited from peary::hal::Resource

Name
std::string _name

Public Functions Documentation

function CurrentSource

  inline CurrentSource(
    component::DAC7678 & dac,
    component::DAC7678::Channel dac_channel,
    component::PCA9539 & pca,
    component::PCA9539::Port pca_port,
    component::PCA9539::Channel pca_channel
)
  

Constructor for CurrentSource class.

Parameters:

  • dac Reference to the DAC7678 component
  • dac_channel The DAC channel to control the current source
  • pca Reference to the PCA9539 component
  • pca_port The PCA port to control the polarity
  • pca_channel The PCA channel to control the polarity

function setCurrent

  inline virtual void setCurrent(
    double current
) override
  

Set the output current for the current source.

Parameters:

  • current The current to set (in amperes)

Reimplements: peary::hal::CurrentControl::setCurrent

function setSwitch

  inline virtual void setSwitch(
    bool enable
) override
  

Enable or disable the output of the current source.

Parameters:

  • enable True to enable the output, false to disable

Reimplements: peary::hal::SwitchControl::setSwitch

function setPolarity

  inline virtual void setPolarity(
    utils::Polarity polarity
) override
  

Set the polarity of the current source.

Parameters:

  • polarity The polarity to set (HIGH for sourcing, LOW for sinking)

Reimplements: peary::hal::CurrentControl::setPolarity


Updated on 2025-11-14 at 11:31:23 +0100