mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpilibc] SPI & I2C: Use handle wrapper to close port (#7217)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <hal/I2C.h>
|
||||
#include <hal/I2CTypes.h>
|
||||
|
||||
namespace frc {
|
||||
@@ -156,7 +157,7 @@ class I2C {
|
||||
bool VerifySensor(int registerAddress, int count, const uint8_t* expected);
|
||||
|
||||
private:
|
||||
hal::I2CPort m_port;
|
||||
hal::Handle<HAL_I2CPort, HAL_CloseI2C, HAL_I2C_kInvalid> m_port;
|
||||
int m_deviceAddress;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <memory>
|
||||
#include <span>
|
||||
|
||||
#include <hal/SPI.h>
|
||||
#include <hal/SPITypes.h>
|
||||
#include <units/time.h>
|
||||
|
||||
@@ -356,7 +357,7 @@ class SPI {
|
||||
double GetAccumulatorIntegratedAverage() const;
|
||||
|
||||
protected:
|
||||
hal::SPIPort m_port;
|
||||
hal::Handle<HAL_SPIPort, HAL_CloseSPI, HAL_SPI_kInvalid> m_port;
|
||||
HAL_SPIMode m_mode = HAL_SPIMode::HAL_SPI_kMode0;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user