Skip to content

Commit

Permalink
Add several nn_ccr functions
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryOderNichts authored and fincs committed Aug 27, 2022
1 parent a8ae667 commit c77e6f6
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 1 deletion.
9 changes: 9 additions & 0 deletions include/nn/ccr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

/**
* \defgroup nn_ccr nn_ccr
*
*/

#include <nn/ccr/sys.h>
#include <nn/ccr/sys_caffeine.h>
112 changes: 112 additions & 0 deletions include/nn/ccr/sys.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#pragma once
#include <wut.h>

/**
* \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

/** @} */
11 changes: 10 additions & 1 deletion include/nn/ccr/sys_caffeine.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#pragma once
#include <wut.h>

/**
* \defgroup nn_ccr_sys_caffeine
* \ingroup nn_ccr
* (see nn::ccr)
* @{
*/

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -25,4 +32,6 @@ CCRSysCaffeineBootCheck();

#ifdef __cplusplus
}
#endif
#endif

/** @} */
2 changes: 2 additions & 0 deletions tests/test_compile_headers_common/test_compile_headers_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
#include <nn/acp/save.h>
#include <nn/acp/title.h>
#include <nn/act/client_cpp.h>
#include <nn/ccr/sys.h>
#include <nn/ccr/sys_caffeine.h>
#include <nn/cmpt/cmpt.h>
#include <nn/ffl/miidata.h>
Expand All @@ -104,6 +105,7 @@
#include <nn/ac.h>
#include <nn/acp.h>
#include <nn/act.h>
#include <nn/ccr.h>
#include <nn/cmpt.h>
#include <nn/result.h>
#include <nn/sl.h>
Expand Down

0 comments on commit c77e6f6

Please sign in to comment.