From 31e97ecc65b813a14f77e4febbbdf9953372cddf Mon Sep 17 00:00:00 2001 From: LRFLEW Date: Wed, 3 Nov 2021 16:11:16 -0500 Subject: [PATCH] Add Error Types for VPAD and KPAD Reads --- include/padscore/kpad.h | 16 +++++++++++++--- include/vpad/input.h | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/padscore/kpad.h b/include/padscore/kpad.h index 6797a395..832b86fa 100644 --- a/include/padscore/kpad.h +++ b/include/padscore/kpad.h @@ -28,8 +28,18 @@ typedef struct KPADVec3D KPADVec3D; //! Error. typedef enum KPADError { - //! No errors. - KPAD_ERROR_OK = 0, + //! No error occurred, and data was written to the buffers. + KPAD_ERROR_OK = 0, + //! There was no sample new data available to write. + KPAD_ERROR_NO_SAMPLES = -1, + //! The requested controller or channel was invalid. + KPAD_ERROR_INVALID_CONTROLLER = -2, + //! WPAD is uninitialized, shouldn't happen unless WPADShutdown() is manually called + KPAD_ERROR_WPAD_UNINIT = -3, + //! KPAD channel is busy, perhaps being accessed by another thread + KPAD_ERROR_BUSY = -4, + //! KPAD is uninitialized, need to call KPADInit() + KPAD_ERROR_UNINITIALIZED = -5, } KPADError; //! 2D vector. @@ -259,7 +269,7 @@ int32_t KPADReadEx(KPADChan chan, KPADStatus *data, uint32_t size, - int32_t *error); + KPADError *error); #ifdef __cplusplus } diff --git a/include/vpad/input.h b/include/vpad/input.h index 9d1a8944..41c72e89 100644 --- a/include/vpad/input.h +++ b/include/vpad/input.h @@ -119,6 +119,10 @@ typedef enum VPADReadError VPAD_READ_NO_SAMPLES = -1, //! The requested controller or channel was invalid. VPAD_READ_INVALID_CONTROLLER = -2, + //! VPAD channel is busy, perhaps being accessed by another thread + VPAD_READ_BUSY = -4, + //! VPAD is uninitialized, need to call VPADInit() + VPAD_READ_UNINITIALIZED = -5, } VPADReadError; //! LCD mode.