ReduxLib C++ 2024.1.1-beta0
Loading...
Searching...
No Matches
redux::sensors::canandcolor::digout::DigoutSlot Class Reference

#include <CanandcolorDigoutSlot.h>

Classes

struct  CompareAffine
 
struct  CompareImmidiate
 
struct  Disabled
 
struct  PrevClauseTrueFor
 
struct  PrevSlotTrueFor
 

Public Types

using DigoutSlotType = std::variant< Disabled, CompareImmidiate, CompareAffine, PrevSlotTrueFor, PrevClauseTrueFor >
 

Public Member Functions

template<std::convertible_to< DigoutSlotType > T>
constexpr DigoutSlot (T slot)
 
constexpr uint64_t ToSettingData () const
 

Static Public Member Functions

static constexpr DigoutSlot FromSettingData (uint64_t data)
 

Public Attributes

DigoutSlotType slotType
 

Detailed Description

Represents a digout "slot" which helps determine the digital output's value.

When a CanandcolorDigout is set in the DigoutMode::DigoutSlot mode, the value of the digital output pin (high or low) is determined by a set of up to 16 "digout slots". These slots can each evaluate a single boolean expression, e.g. "Is the proximity sensor reading above 0.5" or "Is the blue channel reading greater than the red channel minus an offset", and are often able to read from CanandcolorDataSource to accomplish this.

Each slot can be chained by logical AND, OR, or XOR to form compound expressions of "clauses". All clauses have to evaluate to true for the digital output pin's value to be true. If a slot is not joined to the next indexed slot, it terminates a clause – terminating slots without any preceding joining slots are single-slot or "singleton" clauses.

Digout slots can take one of a few forms:

While the boolean outputs are to the digital output pads, the boolean state of each slot is also available over CAN. This DigoutSlotState can be retreived using Canandcolor.GetDigoutState.

Member Typedef Documentation

◆ DigoutSlotType

The std::variant type alias of valid digout slot configs

Constructor & Destructor Documentation

◆ DigoutSlot()

template<std::convertible_to< DigoutSlotType > T>
constexpr redux::sensors::canandcolor::digout::DigoutSlot::DigoutSlot ( slot)
inlineconstexpr

Constructor for DigoutSlot (shouldn't need to be accessed, usually)

Parameters
slotthe actual underlying slot data

Member Function Documentation

◆ FromSettingData()

static constexpr DigoutSlot redux::sensors::canandcolor::digout::DigoutSlot::FromSettingData ( uint64_t  data)
inlinestaticconstexpr

Deserializes a 48-bit setting value into a DigoutSlot object.

Parameters
datasetting data
Returns
DigoutSlot object

◆ ToSettingData()

constexpr uint64_t redux::sensors::canandcolor::digout::DigoutSlot::ToSettingData ( ) const
inlineconstexpr

Serializes the DigoutSlot to a value that can be written in a set settings packet.

Returns
long value (only lower 48 bits are relevant)

Member Data Documentation

◆ slotType

DigoutSlotType redux::sensors::canandcolor::digout::DigoutSlot::slotType

The actual underlying digout slot config specified


The documentation for this class was generated from the following file: