WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::hal Namespace Reference

WPILib Hardware Abstraction Layer (HAL) namespace. More...

Namespaces

namespace  sim
namespace  impl

Classes

class  Handle
 A move-only C++ wrapper around a HAL handle. More...
class  HandleBase
 Base for all HAL Handles. More...
class  UnlimitedHandleResource
 The UnlimitedHandleResource class is a way to track handles. More...
class  LimitedClassedHandleResource
 The LimitedClassedHandleResource class is a way to track handles. More...
struct  HalCallbackListener
class  DigitalHandleResource
 The DigitalHandleResource class is a way to track handles. More...
class  SimCallbackRegistry
 Simulation callback registry. More...
class  fpga_clock
 A std::chrono compatible wrapper around the FPGA Timer. More...
class  ControlWord
 A wrapper around Driver Station control word. More...
class  IndexedClassedHandleResource
 The IndexedClassedHandleResource class is a way to track handles. More...
class  SimDataValue
 Simulation data value wrapper. More...
class  IndexedHandleResource
 The IndexedHandleResource class is a way to track handles. More...
class  SimValue
 C++ wrapper around a HAL simulator value handle. More...
class  SimInt
 C++ wrapper around a HAL simulator int value handle. More...
class  SimLong
 C++ wrapper around a HAL simulator long value handle. More...
class  SimDouble
 C++ wrapper around a HAL simulator double value handle. More...
class  SimEnum
 C++ wrapper around a HAL simulator enum value handle. More...
class  SimBoolean
 C++ wrapper around a HAL simulator boolean value handle. More...
class  SimDevice
 A move-only C++ wrapper around a HAL simulator device handle. More...
class  LimitedHandleResource
 The LimitedHandleResource class is a way to track handles. More...

Enumerations

enum class  HAL_HandleEnum {
  Undefined = 0 , DIO = wpi::util::kHandleTypeHALBase , Port = 2 , Notifier = 3 ,
  Interrupt = 4 , AnalogOutput = 5 , AnalogInput = 6 , AnalogTrigger = 7 ,
  Relay = 8 , PWM = 9 , DigitalPWM = 10 , Counter = 11 ,
  FPGAEncoder = 12 , Encoder = 13 , Compressor = 14 , Solenoid = 15 ,
  AnalogGyro = 16 , Vendor = 17 , SimulationJni = 18 , CAN = 19 ,
  SerialPort = 20 , DutyCycle = 21 , DMA = 22 , AddressableLED = 23 ,
  CTREPCM = 24 , CTREPDP = 25 , REVPDH = 26 , REVPH = 27 ,
  CANStream = 28 , Alert = 29
}
 Enum of HAL handle types. More...
enum class  RobotMode { UNKNOWN = HAL_ROBOTMODE_UNKNOWN , AUTONOMOUS = HAL_ROBOTMODE_AUTONOMOUS , TELEOPERATED = HAL_ROBOTMODE_TELEOPERATED , TEST = HAL_ROBOTMODE_TEST }
 The overall robot mode (not including enabled state). More...

Functions

static int16_t getHandleIndex (HAL_Handle handle)
 Get the handle index from a handle.
static HAL_HandleEnum getHandleType (HAL_Handle handle)
 Get the handle type from a handle.
static bool isHandleType (HAL_Handle handle, HAL_HandleEnum handleType)
 Get if the handle is a specific type.
static bool isHandleCorrectVersion (HAL_Handle handle, int16_t version)
 Get if the version of the handle is correct.
int16_t getHandleTypedIndex (HAL_Handle handle, HAL_HandleEnum enumType, int16_t version)
 Get if the handle is a correct type and version.
HAL_Handle createHandle (int16_t index, HAL_HandleEnum handleType, int16_t version)
 Create a handle for a specific index, type and version.
bool operator== (const ControlWord &lhs, const ControlWord &rhs)
bool operator!= (const ControlWord &lhs, const ControlWord &rhs)
void InitializeDashboardOpMode ()
void SetDashboardOpModeOptions (std::span< const HAL_OpModeOption > options)
void StartDashboardOpMode ()
void EnableDashboardOpMode ()
int64_t GetDashboardSelectedOpMode (HAL_RobotMode robotMode)
ControlWord GetControlWord ()
ControlWord GetUncachedControlWord ()

Variables

constexpr int16_t InvalidHandleIndex = -1

Detailed Description

WPILib Hardware Abstraction Layer (HAL) namespace.

Enumeration Type Documentation

◆ HAL_HandleEnum

enum class wpi::hal::HAL_HandleEnum
strong

Enum of HAL handle types.

Vendors/Teams should use Vendor (17).

Enumerator
Undefined 
DIO 
Port 
Notifier 
Interrupt 
AnalogOutput 
AnalogInput 
AnalogTrigger 
Relay 
PWM 
DigitalPWM 
Counter 
FPGAEncoder 
Encoder 
Compressor 
Solenoid 
AnalogGyro 
Vendor 
SimulationJni 
CAN 
SerialPort 
DutyCycle 
DMA 
AddressableLED 
CTREPCM 
CTREPDP 
REVPDH 
REVPH 
CANStream 
Alert 

◆ RobotMode

enum class wpi::hal::RobotMode
strong

The overall robot mode (not including enabled state).

Enumerator
UNKNOWN 

Unknown.

AUTONOMOUS 

Autonomous.

TELEOPERATED 

Teleoperated.

TEST 

Test.

Function Documentation

◆ createHandle()

HAL_Handle wpi::hal::createHandle ( int16_t index,
HAL_HandleEnum handleType,
int16_t version )

Create a handle for a specific index, type and version.

Note the version is not checked on the roboRIO.

Parameters
indexthe index
handleTypethe handle type
versionthe handle version
Returns
the created handle

◆ EnableDashboardOpMode()

void wpi::hal::EnableDashboardOpMode ( )

◆ GetControlWord()

ControlWord wpi::hal::GetControlWord ( )
inline

◆ GetDashboardSelectedOpMode()

int64_t wpi::hal::GetDashboardSelectedOpMode ( HAL_RobotMode robotMode)

◆ getHandleIndex()

int16_t wpi::hal::getHandleIndex ( HAL_Handle handle)
inlinestatic

Get the handle index from a handle.

Parameters
handlethe handle
Returns
the index

◆ getHandleType()

HAL_HandleEnum wpi::hal::getHandleType ( HAL_Handle handle)
inlinestatic

Get the handle type from a handle.

Parameters
handlethe handle
Returns
the type

◆ getHandleTypedIndex()

int16_t wpi::hal::getHandleTypedIndex ( HAL_Handle handle,
HAL_HandleEnum enumType,
int16_t version )
inline

Get if the handle is a correct type and version.

Note the version is not checked on the roboRIO.

Parameters
handlethe handle
enumTypethe type to check
versionthe handle version to check
Returns
true if the handle is proper version and type, otherwise false.

◆ GetUncachedControlWord()

ControlWord wpi::hal::GetUncachedControlWord ( )
inline

◆ InitializeDashboardOpMode()

void wpi::hal::InitializeDashboardOpMode ( )

◆ isHandleCorrectVersion()

bool wpi::hal::isHandleCorrectVersion ( HAL_Handle handle,
int16_t version )
inlinestatic

Get if the version of the handle is correct.

Do not use on the roboRIO, used specifically for the sim to handle resets.

Parameters
handlethe handle
versionthe handle version to check
Returns
true if the handle is the right version, otherwise false

◆ isHandleType()

bool wpi::hal::isHandleType ( HAL_Handle handle,
HAL_HandleEnum handleType )
inlinestatic

Get if the handle is a specific type.

Parameters
handlethe handle
handleTypethe type to check
Returns
true if the type is correct, otherwise false

◆ operator!=()

bool wpi::hal::operator!= ( const ControlWord & lhs,
const ControlWord & rhs )
inline

◆ operator==()

bool wpi::hal::operator== ( const ControlWord & lhs,
const ControlWord & rhs )
inline

◆ SetDashboardOpModeOptions()

void wpi::hal::SetDashboardOpModeOptions ( std::span< const HAL_OpModeOption > options)

◆ StartDashboardOpMode()

void wpi::hal::StartDashboardOpMode ( )

Variable Documentation

◆ InvalidHandleIndex

int16_t wpi::hal::InvalidHandleIndex = -1
constexpr