ReduxLib C++ 2024.1.1-beta0
|
#include <CanandcolorSettings.h>
Public Member Functions | |
const std::vector< uint8_t > & | SettingAddresses () const override |
void | SetStatusFramePeriod (units::second_t period) |
void | SetProximityFramePeriod (units::second_t period) |
void | SetColorFramePeriod (units::second_t period) |
void | SetDigoutFramePeriod (units::second_t period) |
void | SetFramePeriodLatencyAdjustment (bool adjust) |
void | SetLampLED (bool lamp) |
void | SetLampLEDBrightness (double brightness) |
void | SetProximityConfig (CanandcolorProximityConfig &cfg) |
void | SetColorConfig (CanandcolorColorPeriod period) |
void | SetDigoutOutputMode (CanandcolorDigout digout, DigoutMode config) |
std::optional< units::second_t > | GetStatusFramePeriod () |
std::optional< units::second_t > | GetProximityFramePeriod () |
std::optional< units::second_t > | GetColorFramePeriod () |
std::optional< units::second_t > | GetDigoutFramePeriod () |
std::optional< bool > | GetFramePeriodLatencyAdjustment () |
std::optional< bool > | GetLampLED () |
std::optional< double > | GetLampLEDBrightness () |
std::optional< CanandcolorProximityConfig > | GetProximityConfig () |
std::optional< CanandcolorColorPeriod > | GetColorConfig () |
std::optional< DigoutMode > | GetDigoutOutputMode (CanandcolorDigout digout) |
Public Member Functions inherited from redux::canand::CanandSettings | |
CanandSettings ()=default | |
CanandSettings (CanandSettings &stg) | |
~CanandSettings ()=default | |
std::unordered_map< uint8_t, uint64_t > | FilteredMap () |
bool | AllSettingsReceived () const |
virtual const std::vector< uint8_t > & | SettingAddresses () const |
std::unordered_map< uint8_t, uint64_t > & | GetMap () |
bool | IsEmpty () const |
bool | IsEphemeral () const |
void | SetEphemeral (bool value) |
std::string | ToString () |
Additional Inherited Members | |
Protected Attributes inherited from redux::canand::CanandSettings | |
std::unordered_map< uint8_t, uint64_t > | values |
bool | ephemeral = false |
The settings class for the Canandcolor.
This class holds settings values that can be used to reconfigure Canandcolor via Canandcolor::SetSettings. Additionally, objects of this class are returned from Canandcolor::GetSettings which can be used to read the device's settings.
Note that all Get[setting name] functions may return -1 if they're not populated as CanandcolorSettings objects may not always have a value set for a setting. This is particularly true of instances returned by Canandcolor::GetSettingsAsync(), and you will need to use CanandcolorSettings::AllSettingsReceived() to check if all are present.
However, objects returned by the blocking Canandcolor::GetSettings method will always have all setting values populated.
Example blocking fetch:
std::optional< CanandcolorColorPeriod > redux::sensors::canandcolor::CanandcolorSettings::GetColorConfig | ( | ) |
Gets the device's sampling/integration period for the color sensor, if set.
std::optional< units::second_t > redux::sensors::canandcolor::CanandcolorSettings::GetColorFramePeriod | ( | ) |
Gets the color frame period in seconds [0..65.535], or std::nullopt if the value has not been set on this object. A value of 0 means color messages are disabled.
std::optional< units::second_t > redux::sensors::canandcolor::CanandcolorSettings::GetDigoutFramePeriod | ( | ) |
Gets the digout status frame period in seconds [0..65.535], or std::nullopt if the value has not been set on this object. A value of 0 means digout status messages are disabled.
std::optional< DigoutMode > redux::sensors::canandcolor::CanandcolorSettings::GetDigoutOutputMode | ( | CanandcolorDigout | digout | ) |
Sets the output mode configuration of a digital output pad.
digout | the digital output config to fetch |
std::optional< bool > redux::sensors::canandcolor::CanandcolorSettings::GetFramePeriodLatencyAdjustment | ( | ) |
Gets whether or not to transmit frame periods early if data has just been received. By factory default this setting is enabled.
std::optional< bool > redux::sensors::canandcolor::CanandcolorSettings::GetLampLED | ( | ) |
Gets whether or not the onboard lamp LED setting is to be on.
std::optional< double > redux::sensors::canandcolor::CanandcolorSettings::GetLampLEDBrightness | ( | ) |
Gets the lamp LED's brightness, scaled from 0.0 (off) to 1.0 (max)
std::optional< CanandcolorProximityConfig > redux::sensors::canandcolor::CanandcolorSettings::GetProximityConfig | ( | ) |
Gets whether or not the onboard lamp LED setting is to be on.
std::optional< units::second_t > redux::sensors::canandcolor::CanandcolorSettings::GetProximityFramePeriod | ( | ) |
Gets the proximity frame period in seconds [1..65.535], or std::nullopt if the value has not been set on this object. A value of 0 means proximity messages are disabled.
std::optional< units::second_t > redux::sensors::canandcolor::CanandcolorSettings::GetStatusFramePeriod | ( | ) |
Gets the status frame period in seconds [1..65.535], or std::nullopt if the value has not been set on this object.
void redux::sensors::canandcolor::CanandcolorSettings::SetColorConfig | ( | CanandcolorColorPeriod | period | ) |
Sets the sampling/integration period for the color sensor.
period | the CanandcolorColorPeriod to apply |
void redux::sensors::canandcolor::CanandcolorSettings::SetColorFramePeriod | ( | units::second_t | period | ) |
Sets the color frame period in seconds. By factory default, color frames are broadcast every 40 milliseconds (period=0.04). If 0 is passed in, color frames will be disabled and Canandcolor::GetColor() and other color-reading methods will not return new values.
period | the new period for color frames in seconds in range [0_s, 65.535_s]. |
void redux::sensors::canandcolor::CanandcolorSettings::SetDigoutFramePeriod | ( | units::second_t | period | ) |
Sets the digital output (digout) frame period in seconds. By factory default, digout frames are broadcast every 100 milliseconds (period=0.10). If 0 is passed in, digout frames will be disabled and Canandcolor::GetDigoutState() will not return new values.
period | the new period for digout frames in seconds in range [0_s, 65.535_s]. |
void redux::sensors::canandcolor::CanandcolorSettings::SetDigoutOutputMode | ( | CanandcolorDigout | digout, |
DigoutMode | config | ||
) |
Sets the output mode of a digital output pad.
Digout pins can be set into one of three modes:
digout | the digout to configure (either CanandcolorDigout::kDigout1 or CanandcolorDigout::kDigout2) |
config | a DigoutMode specifying how the digital output should output if at all. See DigoutMode for example usage. |
void redux::sensors::canandcolor::CanandcolorSettings::SetFramePeriodLatencyAdjustment | ( | bool | adjust | ) |
Sets whether or not to transmit frame periods early if data has just been received. This applies only in the case where frame periods for color and proximity are equal to or less than the configured sampling periods of their corresponding ICs, which is true by default.
This increases CAN utilization a little, but minimizes latency.
By factory default this setting is enabled.
adjust | Whether to enable latency adjustment |
void redux::sensors::canandcolor::CanandcolorSettings::SetLampLED | ( | bool | lamp | ) |
Sets whether or not the onboard lamp LED is to be powered.
The LED can als be physically turned off regardless of setting with the onboard switch.
The LED is useful for measuring the color of objects that do not themselves emit light (e.g. most game pieces) or for using the white channel to estimate very close proximity.
By factory default this setting is enabled.
lamp | whether to enable or disable the lamp LED |
void redux::sensors::canandcolor::CanandcolorSettings::SetLampLEDBrightness | ( | double | brightness | ) |
Sets the brightness of the onboard lamp LED.
The LED can als be physically turned off regardless of setting with the onboard switch.
By factory default this setting is set to max brightness (1.0)
brightness | scaled brightness from 0.0 (off) to 1.0 (max brightness) |
void redux::sensors::canandcolor::CanandcolorSettings::SetProximityConfig | ( | CanandcolorProximityConfig & | cfg | ) |
Sets fine-tuned settings for the proximity sensor through values in a CanandcolorProximityConfig object.
cfg | the configruation object to apply setings from |
void redux::sensors::canandcolor::CanandcolorSettings::SetProximityFramePeriod | ( | units::second_t | period | ) |
Sets the proximity frame period in seconds. By factory default, proximity frames are broadcast every 10 milliseconds (period=0.01). If 0 is passed in, proximity frames will be disabled and Canandcolor::GetProximity() will not return new values.
period | the new period for proximity frames in seconds in range [0_s, 65.535_s]. |
void redux::sensors::canandcolor::CanandcolorSettings::SetStatusFramePeriod | ( | units::second_t | period | ) |
Sets the status frame period in seconds. By factory default, the device will broadcast 1 status message every second (period=1.0).
period | the new period for status frames in seconds in range [1.0_s, 65.535_s]. |
|
overridevirtual |
Gets the array of settings addresses this settings class records.
Reimplemented from redux::canand::CanandSettings.