mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Prepends all HAL functions with HAL_ (#146)
This commit is contained in:
committed by
Peter Johnson
parent
5ad28d58ec
commit
b637b9ee4c
@@ -24,27 +24,27 @@ AnalogOutput::AnalogOutput(uint32_t channel) {
|
||||
std::stringstream buf;
|
||||
buf << "analog input " << channel;
|
||||
|
||||
if (!checkAnalogOutputChannel(channel)) {
|
||||
if (!HAL_CheckAnalogOutputChannel(channel)) {
|
||||
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
|
||||
m_channel = std::numeric_limits<uint32_t>::max();
|
||||
m_port = HAL_INVALID_HANDLE;
|
||||
m_port = HAL_kInvalidHandle;
|
||||
return;
|
||||
}
|
||||
|
||||
m_channel = channel;
|
||||
|
||||
HalPortHandle port = getPort(m_channel);
|
||||
HAL_PortHandle port = HAL_GetPort(m_channel);
|
||||
int32_t status = 0;
|
||||
m_port = initializeAnalogOutputPort(port, &status);
|
||||
m_port = HAL_InitializeAnalogOutputPort(port, &status);
|
||||
if (status != 0) {
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
m_channel = std::numeric_limits<uint32_t>::max();
|
||||
m_port = HAL_INVALID_HANDLE;
|
||||
m_port = HAL_kInvalidHandle;
|
||||
return;
|
||||
}
|
||||
|
||||
LiveWindow::GetInstance()->AddActuator("AnalogOutput", m_channel, this);
|
||||
HALReport(HALUsageReporting::kResourceType_AnalogOutput, m_channel);
|
||||
HAL_Report(HALUsageReporting::kResourceType_AnalogOutput, m_channel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ AnalogOutput::AnalogOutput(uint32_t channel) {
|
||||
*
|
||||
* Frees analog output resource.
|
||||
*/
|
||||
AnalogOutput::~AnalogOutput() { freeAnalogOutputPort(m_port); }
|
||||
AnalogOutput::~AnalogOutput() { HAL_FreeAnalogOutputPort(m_port); }
|
||||
|
||||
/**
|
||||
* Set the value of the analog output.
|
||||
@@ -61,9 +61,9 @@ AnalogOutput::~AnalogOutput() { freeAnalogOutputPort(m_port); }
|
||||
*/
|
||||
void AnalogOutput::SetVoltage(float voltage) {
|
||||
int32_t status = 0;
|
||||
setAnalogOutput(m_port, voltage, &status);
|
||||
HAL_SetAnalogOutput(m_port, voltage, &status);
|
||||
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,9 +73,9 @@ void AnalogOutput::SetVoltage(float voltage) {
|
||||
*/
|
||||
float AnalogOutput::GetVoltage() const {
|
||||
int32_t status = 0;
|
||||
float voltage = getAnalogOutput(m_port, &status);
|
||||
float voltage = HAL_GetAnalogOutput(m_port, &status);
|
||||
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
|
||||
return voltage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user