mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Prepends all HAL functions with HAL_ (#146)
This commit is contained in:
committed by
Peter Johnson
parent
5ad28d58ec
commit
b637b9ee4c
@@ -18,16 +18,16 @@
|
||||
I2C::I2C(Port port, uint8_t deviceAddress)
|
||||
: m_port(port), m_deviceAddress(deviceAddress) {
|
||||
int32_t status = 0;
|
||||
i2CInitialize(m_port, &status);
|
||||
// wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
HAL_I2CInitialize(m_port, &status);
|
||||
// wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
|
||||
HALReport(HALUsageReporting::kResourceType_I2C, deviceAddress);
|
||||
HAL_Report(HALUsageReporting::kResourceType_I2C, deviceAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
I2C::~I2C() { i2CClose(m_port); }
|
||||
I2C::~I2C() { HAL_I2CClose(m_port); }
|
||||
|
||||
/**
|
||||
* Generic transaction.
|
||||
@@ -44,9 +44,9 @@ I2C::~I2C() { i2CClose(m_port); }
|
||||
bool I2C::Transaction(uint8_t* dataToSend, uint8_t sendSize,
|
||||
uint8_t* dataReceived, uint8_t receiveSize) {
|
||||
int32_t status = 0;
|
||||
status = i2CTransaction(m_port, m_deviceAddress, dataToSend, sendSize,
|
||||
dataReceived, receiveSize);
|
||||
// wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
status = HAL_I2CTransaction(m_port, m_deviceAddress, dataToSend, sendSize,
|
||||
dataReceived, receiveSize);
|
||||
// wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return status < receiveSize;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ bool I2C::Write(uint8_t registerAddress, uint8_t data) {
|
||||
buffer[0] = registerAddress;
|
||||
buffer[1] = data;
|
||||
int32_t status = 0;
|
||||
status = i2CWrite(m_port, m_deviceAddress, buffer, sizeof(buffer));
|
||||
status = HAL_I2CWrite(m_port, m_deviceAddress, buffer, sizeof(buffer));
|
||||
return status < static_cast<int32_t>(sizeof(buffer));
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ bool I2C::Write(uint8_t registerAddress, uint8_t data) {
|
||||
*/
|
||||
bool I2C::WriteBulk(uint8_t* data, uint8_t count) {
|
||||
int32_t status = 0;
|
||||
status = i2CWrite(m_port, m_deviceAddress, data, count);
|
||||
status = HAL_I2CWrite(m_port, m_deviceAddress, data, count);
|
||||
return status < count;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ bool I2C::ReadOnly(uint8_t count, uint8_t* buffer) {
|
||||
return true;
|
||||
}
|
||||
int32_t status = 0;
|
||||
status = i2CRead(m_port, m_deviceAddress, buffer, count);
|
||||
status = HAL_I2CRead(m_port, m_deviceAddress, buffer, count);
|
||||
return status < count;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user