mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Finishes Prefix Renames (#152)
This commit is contained in:
committed by
Peter Johnson
parent
b637b9ee4c
commit
43a2eccdc9
@@ -20,7 +20,7 @@
|
||||
SPI::SPI(Port SPIport) {
|
||||
m_port = SPIport;
|
||||
int32_t status = 0;
|
||||
HAL_SpiInitialize(m_port, &status);
|
||||
HAL_InitializeSPI(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
|
||||
static int32_t instances = 0;
|
||||
@@ -31,7 +31,7 @@ SPI::SPI(Port SPIport) {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
SPI::~SPI() { HAL_SpiClose(m_port); }
|
||||
SPI::~SPI() { HAL_CloseSPI(m_port); }
|
||||
|
||||
/**
|
||||
* Configure the rate of the generated clock signal.
|
||||
@@ -41,7 +41,7 @@ SPI::~SPI() { HAL_SpiClose(m_port); }
|
||||
*
|
||||
* @param hz The clock rate in Hertz.
|
||||
*/
|
||||
void SPI::SetClockRate(double hz) { HAL_SpiSetSpeed(m_port, hz); }
|
||||
void SPI::SetClockRate(double hz) { HAL_SetSPISpeed(m_port, hz); }
|
||||
|
||||
/**
|
||||
* Configure the order that bits are sent and received on the wire
|
||||
@@ -49,7 +49,7 @@ void SPI::SetClockRate(double hz) { HAL_SpiSetSpeed(m_port, hz); }
|
||||
*/
|
||||
void SPI::SetMSBFirst() {
|
||||
m_msbFirst = true;
|
||||
HAL_SpiSetOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
HAL_SetSPIOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
(int)m_clk_idle_high);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ void SPI::SetMSBFirst() {
|
||||
*/
|
||||
void SPI::SetLSBFirst() {
|
||||
m_msbFirst = false;
|
||||
HAL_SpiSetOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
HAL_SetSPIOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
(int)m_clk_idle_high);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void SPI::SetLSBFirst() {
|
||||
*/
|
||||
void SPI::SetSampleDataOnFalling() {
|
||||
m_sampleOnTrailing = true;
|
||||
HAL_SpiSetOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
HAL_SetSPIOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
(int)m_clk_idle_high);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ void SPI::SetSampleDataOnFalling() {
|
||||
*/
|
||||
void SPI::SetSampleDataOnRising() {
|
||||
m_sampleOnTrailing = false;
|
||||
HAL_SpiSetOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
HAL_SetSPIOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
(int)m_clk_idle_high);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ void SPI::SetSampleDataOnRising() {
|
||||
*/
|
||||
void SPI::SetClockActiveLow() {
|
||||
m_clk_idle_high = true;
|
||||
HAL_SpiSetOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
HAL_SetSPIOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
(int)m_clk_idle_high);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ void SPI::SetClockActiveLow() {
|
||||
*/
|
||||
void SPI::SetClockActiveHigh() {
|
||||
m_clk_idle_high = false;
|
||||
HAL_SpiSetOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
HAL_SetSPIOpts(m_port, (int)m_msbFirst, (int)m_sampleOnTrailing,
|
||||
(int)m_clk_idle_high);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ void SPI::SetClockActiveHigh() {
|
||||
*/
|
||||
void SPI::SetChipSelectActiveHigh() {
|
||||
int32_t status = 0;
|
||||
HAL_SpiSetChipSelectActiveHigh(m_port, &status);
|
||||
HAL_SetSPIChipSelectActiveHigh(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void SPI::SetChipSelectActiveHigh() {
|
||||
*/
|
||||
void SPI::SetChipSelectActiveLow() {
|
||||
int32_t status = 0;
|
||||
HAL_SpiSetChipSelectActiveLow(m_port, &status);
|
||||
HAL_SetSPIChipSelectActiveLow(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void SPI::SetChipSelectActiveLow() {
|
||||
*/
|
||||
int32_t SPI::Write(uint8_t* data, uint8_t size) {
|
||||
int32_t retVal = 0;
|
||||
retVal = HAL_SpiWrite(m_port, data, size);
|
||||
retVal = HAL_WriteSPI(m_port, data, size);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -152,9 +152,9 @@ int32_t SPI::Read(bool initiate, uint8_t* dataReceived, uint8_t size) {
|
||||
if (initiate) {
|
||||
auto dataToSend = new uint8_t[size];
|
||||
std::memset(dataToSend, 0, size);
|
||||
retVal = HAL_SpiTransaction(m_port, dataToSend, dataReceived, size);
|
||||
retVal = HAL_TransactionSPI(m_port, dataToSend, dataReceived, size);
|
||||
} else
|
||||
retVal = HAL_SpiRead(m_port, dataReceived, size);
|
||||
retVal = HAL_ReadSPI(m_port, dataReceived, size);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ int32_t SPI::Read(bool initiate, uint8_t* dataReceived, uint8_t size) {
|
||||
int32_t SPI::Transaction(uint8_t* dataToSend, uint8_t* dataReceived,
|
||||
uint8_t size) {
|
||||
int32_t retVal = 0;
|
||||
retVal = HAL_SpiTransaction(m_port, dataToSend, dataReceived, size);
|
||||
retVal = HAL_TransactionSPI(m_port, dataToSend, dataReceived, size);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ void SPI::InitAccumulator(double period, uint32_t cmd, uint8_t xfer_size,
|
||||
uint8_t data_shift, uint8_t data_size, bool is_signed,
|
||||
bool big_endian) {
|
||||
int32_t status = 0;
|
||||
HAL_SpiInitAccumulator(m_port, (uint32_t)(period * 1e6), cmd, xfer_size,
|
||||
HAL_InitSPIAccumulator(m_port, (uint32_t)(period * 1e6), cmd, xfer_size,
|
||||
valid_mask, valid_value, data_shift, data_size,
|
||||
is_signed, big_endian, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
@@ -203,7 +203,7 @@ void SPI::InitAccumulator(double period, uint32_t cmd, uint8_t xfer_size,
|
||||
*/
|
||||
void SPI::FreeAccumulator() {
|
||||
int32_t status = 0;
|
||||
HAL_SpiFreeAccumulator(m_port, &status);
|
||||
HAL_FreeSPIAccumulator(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ void SPI::FreeAccumulator() {
|
||||
*/
|
||||
void SPI::ResetAccumulator() {
|
||||
int32_t status = 0;
|
||||
HAL_SpiResetAccumulator(m_port, &status);
|
||||
HAL_ResetSPIAccumulator(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ void SPI::ResetAccumulator() {
|
||||
*/
|
||||
void SPI::SetAccumulatorCenter(int32_t center) {
|
||||
int32_t status = 0;
|
||||
HAL_SpiSetAccumulatorCenter(m_port, center, &status);
|
||||
HAL_SetSPIAccumulatorCenter(m_port, center, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ void SPI::SetAccumulatorCenter(int32_t center) {
|
||||
*/
|
||||
void SPI::SetAccumulatorDeadband(int32_t deadband) {
|
||||
int32_t status = 0;
|
||||
HAL_SpiSetAccumulatorDeadband(m_port, deadband, &status);
|
||||
HAL_SetSPIAccumulatorDeadband(m_port, deadband, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ void SPI::SetAccumulatorDeadband(int32_t deadband) {
|
||||
*/
|
||||
int32_t SPI::GetAccumulatorLastValue() const {
|
||||
int32_t status = 0;
|
||||
int32_t retVal = HAL_SpiGetAccumulatorLastValue(m_port, &status);
|
||||
int32_t retVal = HAL_GetSPIAccumulatorLastValue(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ int32_t SPI::GetAccumulatorLastValue() const {
|
||||
*/
|
||||
int64_t SPI::GetAccumulatorValue() const {
|
||||
int32_t status = 0;
|
||||
int64_t retVal = HAL_SpiGetAccumulatorValue(m_port, &status);
|
||||
int64_t retVal = HAL_GetSPIAccumulatorValue(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ int64_t SPI::GetAccumulatorValue() const {
|
||||
*/
|
||||
uint32_t SPI::GetAccumulatorCount() const {
|
||||
int32_t status = 0;
|
||||
uint32_t retVal = HAL_SpiGetAccumulatorCount(m_port, &status);
|
||||
uint32_t retVal = HAL_GetSPIAccumulatorCount(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ uint32_t SPI::GetAccumulatorCount() const {
|
||||
*/
|
||||
double SPI::GetAccumulatorAverage() const {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_SpiGetAccumulatorAverage(m_port, &status);
|
||||
double retVal = HAL_GetSPIAccumulatorAverage(m_port, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
@@ -299,6 +299,6 @@ double SPI::GetAccumulatorAverage() const {
|
||||
*/
|
||||
void SPI::GetAccumulatorOutput(int64_t& value, uint32_t& count) const {
|
||||
int32_t status = 0;
|
||||
HAL_SpiGetAccumulatorOutput(m_port, &value, &count, &status);
|
||||
HAL_GetSPIAccumulatorOutput(m_port, &value, &count, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user