Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add several nn_ccr functions #264

Merged
merged 1 commit into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use a enum for the slot? (Something similar to OSScreenID?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was thinking about that, but this slot 0/1 logic is used in several files throughout #265 and didn't want to create an enum for each of them.


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