mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Add kInvalid value to HAL_I2CPort and HAL_SPIPort (#1329)
This allows HAL_CloseI2C() and HAL_CloseSPI() to be noops, which makes enabling move semantics in the I2C and SPI wpilibc classes easier and cleaner. Fixes #1328.
This commit is contained in:
committed by
Peter Johnson
parent
b505bbefd1
commit
467c9fd686
@@ -11,13 +11,12 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <hal/SPI.h>
|
||||
#include <wpi/ArrayRef.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc/ErrorBase.h"
|
||||
|
||||
enum HAL_SPIPort : int32_t;
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DigitalSource;
|
||||
@@ -315,7 +314,7 @@ class SPI : public ErrorBase {
|
||||
void GetAccumulatorOutput(int64_t& value, int64_t& count) const;
|
||||
|
||||
protected:
|
||||
HAL_SPIPort m_port;
|
||||
HAL_SPIPort m_port = HAL_SPI_kInvalid;
|
||||
bool m_msbFirst = false; // Default little-endian
|
||||
bool m_sampleOnTrailing = false; // Default data updated on falling edge
|
||||
bool m_clockIdleHigh = false; // Default clock active high
|
||||
|
||||
Reference in New Issue
Block a user