mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Adds a const buffer listener (#742)
Replaces need for const_cast in SPI and I2C functions
This commit is contained in:
committed by
Peter Johnson
parent
a20474bfc7
commit
cd1dbb1e3a
@@ -30,7 +30,7 @@ int32_t HALSIM_RegisterI2CReadCallback(int32_t index,
|
||||
void HALSIM_CancelI2CReadCallback(int32_t index, int32_t uid);
|
||||
|
||||
int32_t HALSIM_RegisterI2CWriteCallback(int32_t index,
|
||||
HAL_BufferCallback callback,
|
||||
HAL_ConstBufferCallback callback,
|
||||
void* param);
|
||||
void HALSIM_CancelI2CWriteCallback(int32_t index, int32_t uid);
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@ typedef void (*HAL_NotifyCallback)(const char* name, void* param,
|
||||
typedef void (*HAL_BufferCallback)(const char* name, void* param,
|
||||
unsigned char* buffer, unsigned int count);
|
||||
|
||||
typedef void (*HAL_ConstBufferCallback)(const char* name, void* param,
|
||||
const unsigned char* buffer,
|
||||
unsigned int count);
|
||||
|
||||
namespace hal {
|
||||
|
||||
template <typename CallbackFunction>
|
||||
|
||||
@@ -132,5 +132,7 @@ void HalCallbackListenerVectorImpl<ListenerType>::erase_impl(unsigned int uid) {
|
||||
|
||||
typedef HalCallbackListenerVectorImpl<HAL_NotifyCallback> NotifyListenerVector;
|
||||
typedef HalCallbackListenerVectorImpl<HAL_BufferCallback> BufferListenerVector;
|
||||
typedef HalCallbackListenerVectorImpl<HAL_ConstBufferCallback>
|
||||
ConstBufferListenerVector;
|
||||
|
||||
} // namespace hal
|
||||
|
||||
@@ -30,7 +30,7 @@ int32_t HALSIM_RegisterSPIReadCallback(int32_t index,
|
||||
void HALSIM_CancelSPIReadCallback(int32_t index, int32_t uid);
|
||||
|
||||
int32_t HALSIM_RegisterSPIWriteCallback(int32_t index,
|
||||
HAL_BufferCallback callback,
|
||||
HAL_ConstBufferCallback callback,
|
||||
void* param);
|
||||
void HALSIM_CancelSPIWriteCallback(int32_t index, int32_t uid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user