mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Prepends all HAL functions with HAL_ (#146)
This commit is contained in:
committed by
Peter Johnson
parent
5ad28d58ec
commit
b637b9ee4c
@@ -33,16 +33,16 @@ DigitalInput::DigitalInput(uint32_t channel) {
|
||||
m_channel = channel;
|
||||
|
||||
int32_t status = 0;
|
||||
m_handle = initializeDIOPort(getPort(channel), true, &status);
|
||||
m_handle = HAL_InitializeDIOPort(HAL_GetPort(channel), true, &status);
|
||||
if (status != 0) {
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
m_handle = HAL_INVALID_HANDLE;
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
m_handle = HAL_kInvalidHandle;
|
||||
m_channel = std::numeric_limits<uint32_t>::max();
|
||||
return;
|
||||
}
|
||||
|
||||
LiveWindow::GetInstance()->AddSensor("DigitalInput", channel, this);
|
||||
HALReport(HALUsageReporting::kResourceType_DigitalInput, channel);
|
||||
HAL_Report(HALUsageReporting::kResourceType_DigitalInput, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,14 +50,14 @@ DigitalInput::DigitalInput(uint32_t channel) {
|
||||
*/
|
||||
DigitalInput::~DigitalInput() {
|
||||
if (StatusIsFatal()) return;
|
||||
if (m_interrupt != HAL_INVALID_HANDLE) {
|
||||
if (m_interrupt != HAL_kInvalidHandle) {
|
||||
int32_t status = 0;
|
||||
cleanInterrupts(m_interrupt, &status);
|
||||
HAL_CleanInterrupts(m_interrupt, &status);
|
||||
// ignore status, as an invalid handle just needs to be ignored.
|
||||
m_interrupt = HAL_INVALID_HANDLE;
|
||||
m_interrupt = HAL_kInvalidHandle;
|
||||
}
|
||||
|
||||
freeDIOPort(m_handle);
|
||||
HAL_FreeDIOPort(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,8 +68,8 @@ DigitalInput::~DigitalInput() {
|
||||
bool DigitalInput::Get() const {
|
||||
if (StatusIsFatal()) return false;
|
||||
int32_t status = 0;
|
||||
bool value = getDIO(m_handle, &status);
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
bool value = HAL_GetDIO(m_handle, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ uint32_t DigitalInput::GetChannel() const { return m_channel; }
|
||||
/**
|
||||
* @return The HAL Handle to the specified source.
|
||||
*/
|
||||
HalHandle DigitalInput::GetPortHandleForRouting() const { return m_handle; }
|
||||
HAL_Handle DigitalInput::GetPortHandleForRouting() const { return m_handle; }
|
||||
|
||||
/**
|
||||
* Is source an AnalogTrigger
|
||||
|
||||
Reference in New Issue
Block a user