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:
Tyler Veness
2018-09-23 21:14:04 -07:00
committed by Peter Johnson
parent b505bbefd1
commit 467c9fd686
6 changed files with 23 additions and 23 deletions

View File

@@ -18,7 +18,7 @@
*/
// clang-format off
HAL_ENUM(HAL_I2CPort) { HAL_I2C_kOnboard = 0, HAL_I2C_kMXP };
HAL_ENUM(HAL_I2CPort) { HAL_I2C_kInvalid = -1, HAL_I2C_kOnboard, HAL_I2C_kMXP };
// clang-format on
#ifdef __cplusplus

View File

@@ -20,7 +20,8 @@
// clang-format off
HAL_ENUM(HAL_SPIPort) {
HAL_SPI_kOnboardCS0 = 0,
HAL_SPI_kInvalid = -1,
HAL_SPI_kOnboardCS0,
HAL_SPI_kOnboardCS1,
HAL_SPI_kOnboardCS2,
HAL_SPI_kOnboardCS3,