Class DigoutSlotState
java.lang.Object
com.reduxrobotics.sensors.canandcolor.DigoutSlotState
- All Implemented Interfaces:
StructSerializable
,WPISerializable
Class representing the state of the Canandcolor digout channels and slots.
This includes the overall value of both channels
and their
sticky values, as well as the states of all 32 individual digout logic slots
(mostly available for debugging purposes and for the benefit of Alchemist).
See DigoutChannel
on how to configure digout logic.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final DigoutSlotStateStruct
This field is necessary for WPILib structs to work around Java type erasure. -
Constructor Summary
ConstructorDescriptionInstatiate with blank (all zeros) digout state.DigoutSlotState
(long field) Constructor -- used by theCanandcolor
class to populate this object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the output value of either digital output channel, which corresponds to what the Canandcolor is outputting on those pins (assuming digout slot mode rather than duty cycle) Note that this ignores normally open/normally connected, so even if the board output is high electrically, the digital output state may be false.int
Gets a little endian 16-bit bitfield of individual digout slot values.boolean
getDigoutSlotValue
(DigoutChannel.Index digout, int slot) Gets the boolean value of a specific digout slot contributing to a digital output.boolean
Gets the sticky flag of either digital output channel, which corresponds to whether the Canandcolor has flagged the digout for ever being true.
-
Field Details
-
struct
This field is necessary for WPILib structs to work around Java type erasure.
-
-
Constructor Details
-
DigoutSlotState
public DigoutSlotState(long field) Constructor -- used by theCanandcolor
class to populate this object.- Parameters:
field
- Digital output bitset from the CAN message
-
DigoutSlotState
public DigoutSlotState()Instatiate with blank (all zeros) digout state.
-
-
Method Details
-
getDigoutChannelValue
Gets the output value of either digital output channel, which corresponds to what the Canandcolor is outputting on those pins (assuming digout slot mode rather than duty cycle) Note that this ignores normally open/normally connected, so even if the board output is high electrically, the digital output state may be false.- Parameters:
digout
- The digital output whose value is to be returned- Returns:
- the boolean state of that digital output
-
getStickyDigoutValue
Gets the sticky flag of either digital output channel, which corresponds to whether the Canandcolor has flagged the digout for ever being true.Note that this ignores normally open/normally connected, so even if the board output is high electrically, the digital output state may be false.
These sticky flags can be cleared with
Canandcolor.clearStickyDigoutFlags()
- Parameters:
digout
- The digital output whose value is to be returned- Returns:
- the boolean state of that digital output
-
getDigoutSlotValue
Gets the boolean value of a specific digout slot contributing to a digital output.- Parameters:
digout
- the digital output associated with the slotslot
- the slot index- Returns:
- Whether or not that specific slot is returning true or not.
-
getDigoutSlotBitfield
Gets a little endian 16-bit bitfield of individual digout slot values.- Parameters:
digout
- the digital output associated with the slots- Returns:
- slot bitfield
-