mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Uses ComputeDigitalMask function across HAL DIO (#837)
less risk for errors in the future.
This commit is contained in:
committed by
Peter Johnson
parent
11b99a016a
commit
c84bd744c8
@@ -10,6 +10,7 @@
|
||||
#include <support/mutex.h>
|
||||
|
||||
#include "HAL/ChipObject.h"
|
||||
#include "HAL/DIO.h"
|
||||
#include "HAL/Types.h"
|
||||
|
||||
namespace hal {
|
||||
@@ -41,10 +42,10 @@ struct DIOSetProxy {
|
||||
tDIO::tDO m_unsetOutputStateReg;
|
||||
tDIO* m_dio;
|
||||
};
|
||||
int32_t ComputeDigitalMask(uint8_t channel);
|
||||
namespace detail {
|
||||
wpi::mutex& UnsafeGetDIOMutex();
|
||||
tDIO* UnsafeGetDigialSystem();
|
||||
int32_t ComputeDigitalMask(HAL_DigitalHandle handle, int32_t* status);
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
@@ -65,7 +66,7 @@ void UnsafeManipulateDIO(HAL_DigitalHandle handle, int32_t* status,
|
||||
}
|
||||
wpi::mutex& dioMutex = detail::UnsafeGetDIOMutex();
|
||||
tDIO* dSys = detail::UnsafeGetDigialSystem();
|
||||
auto mask = detail::ComputeDigitalMask(handle, status);
|
||||
auto mask = ComputeDigitalMask(port->channel);
|
||||
if (status != 0) return;
|
||||
std::lock_guard<wpi::mutex> lock(dioMutex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user