From c77e6f601577042644ae0ad07882734cb901a2fe Mon Sep 17 00:00:00 2001 From: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> Date: Fri, 26 Aug 2022 23:35:27 +0200 Subject: [PATCH] Add several nn_ccr functions --- include/nn/ccr.h | 9 ++ include/nn/ccr/sys.h | 112 ++++++++++++++++++ include/nn/ccr/sys_caffeine.h | 11 +- .../test_compile_headers_list.h | 2 + 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 include/nn/ccr.h create mode 100644 include/nn/ccr/sys.h diff --git a/include/nn/ccr.h b/include/nn/ccr.h new file mode 100644 index 000000000..7e3776aa1 --- /dev/null +++ b/include/nn/ccr.h @@ -0,0 +1,9 @@ +#pragma once + +/** + * \defgroup nn_ccr nn_ccr + * + */ + +#include +#include diff --git a/include/nn/ccr/sys.h b/include/nn/ccr/sys.h new file mode 100644 index 000000000..621d01395 --- /dev/null +++ b/include/nn/ccr/sys.h @@ -0,0 +1,112 @@ +#pragma once +#include + +/** + * \defgroup nn_ccr_sys + * \ingroup nn_ccr + * (see nn::ccr) + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum CCRSysPairingState +{ + //! Pairing is complete / hasn't started yet + CCR_SYS_PAIRING_FINISHED = 0, + //! Pairing is in progress + CCR_SYS_PAIRING_IN_PROGRESS = 1, + //! Pairing timed out + CCR_SYS_PAIRING_TIMED_OUT = 2, +} CCRSysPairingState; + +void +CCRSysInit(void); + +void +CCRSysExit(void); + +/** + * Shutdown the DRC in slot 0. + * + * \return + * 0 on success. + */ +int32_t +CCRSysDRCShutdown(void); + +/** + * Invalidate the DRC pairing in slot 0. + * + * \return + * 0 on success. + */ +int32_t +CCRSysInvalidatePairing(void); + +/** + * Check if the DRC in the specified slot is attached. + * + * \param drcSlot + * Slot from 0 to 1. + * + * \return + * \c TRUE if attached. + */ +BOOL +__CCRSysDRCIsAttached(uint32_t drcSlot); + +/** + * Starts the pairing process for the specified slot. + * + * \param drcSlot + * Slot from 0 to 1. + * + * \param timeout + * Timeout in seconds. + * + * \return + * 0 on success. + */ +int32_t +CCRSysStartPairing(uint32_t drcSlot, + uint32_t timeout); + +/** + * Stops the pairing process. + * + * \return + * 0 on success. + */ +int32_t +CCRSysStopPairing(void); + +/** + * Gets the current pairing state. + * + * \return + * The pairing state. + */ +CCRSysPairingState +CCRSysGetPairingState(void); + +/** + * Gets the pin code used for pairing in decimal representation. + * ♠ = 0, ♥ = 1, ♦ = 2, ♣ = 3 + * + * \param pin + * Pointer to write the pin code to. + * + * \return + * 0 on success. + */ +int32_t +CCRSysGetPincode(uint32_t *pin); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/include/nn/ccr/sys_caffeine.h b/include/nn/ccr/sys_caffeine.h index 440b7fe12..55370032f 100644 --- a/include/nn/ccr/sys_caffeine.h +++ b/include/nn/ccr/sys_caffeine.h @@ -1,6 +1,13 @@ #pragma once #include +/** + * \defgroup nn_ccr_sys_caffeine + * \ingroup nn_ccr + * (see nn::ccr) + * @{ + */ + #ifdef __cplusplus extern "C" { #endif @@ -25,4 +32,6 @@ CCRSysCaffeineBootCheck(); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif + +/** @} */ diff --git a/tests/test_compile_headers_common/test_compile_headers_list.h b/tests/test_compile_headers_common/test_compile_headers_list.h index f8ac7ae46..7a76e74bd 100644 --- a/tests/test_compile_headers_common/test_compile_headers_list.h +++ b/tests/test_compile_headers_common/test_compile_headers_list.h @@ -92,6 +92,7 @@ #include #include #include +#include #include #include #include @@ -104,6 +105,7 @@ #include #include #include +#include #include #include #include