Add support for configuring SPI Auto Stall Config (#2193)

This commit is contained in:
Thad House
2019-12-24 10:52:58 -08:00
committed by Peter Johnson
parent 3259cffc63
commit bdc1cab013
8 changed files with 89 additions and 9 deletions

View File

@@ -311,6 +311,14 @@ int SPI::GetAutoDroppedCount() {
return val;
}
void SPI::ConfigureAutoStall(HAL_SPIPort port, int csToSclkTicks,
int stallTicks, int pow2BytesPerRead) {
int32_t status = 0;
HAL_ConfigureSPIAutoStall(m_port, csToSclkTicks, stallTicks, pow2BytesPerRead,
&status);
wpi_setHALError(status);
}
void SPI::InitAccumulator(units::second_t period, int cmd, int xferSize,
int validMask, int validValue, int dataShift,
int dataSize, bool isSigned, bool bigEndian) {

View File

@@ -269,6 +269,19 @@ class SPI : public ErrorBase {
*/
int GetAutoDroppedCount();
/**
* Configure the Auto SPI Stall time between reads.
*
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
* MXP.
* @param csToSclkTicks the number of ticks to wait before asserting the cs
* pin
* @param stallTicks the number of ticks to stall for
* @param pow2BytesPerRead the number of bytes to read before stalling
*/
void ConfigureAutoStall(HAL_SPIPort port, int csToSclkTicks, int stallTicks,
int pow2BytesPerRead);
/**
* Initialize the accumulator.
*