Skip to content
Open
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
8 changes: 8 additions & 0 deletions libctru/include/3ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ extern "C" {
#include <3ds/services/srvpm.h>
#include <3ds/services/loader.h>
#include <3ds/services/y2r.h>
#include <3ds/services/mcucam.h>
#include <3ds/services/mcugpu.h>
#include <3ds/services/mcuhid.h>
#include <3ds/services/mcurtc.h>
#include <3ds/services/mcusnd.h>
#include <3ds/services/mcunwm.h>
#include <3ds/services/mcuhwc.h>
#include <3ds/services/mcupls.h>
#include <3ds/services/mcucdc.h>
#include <3ds/services/cdcchk.h>

#include <3ds/gpu/gx.h>
Expand Down
315 changes: 315 additions & 0 deletions libctru/include/3ds/services/mcu_common.h

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions libctru/include/3ds/services/mcucam.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @file mcucam.h
* @brief MCU Camera service.
*/
#pragma once

#include <3ds/types.h>
#include <3ds/services/mcu_common.h>

/// Initializes mcuCam.
Result mcuCamInit(void);

/// Exits mcuCam.
void mcuCamExit(void);

/**
* @brief Gets the current mcuCam session handle.
* @return A pointer to the current mcuCam session handle.
*/
Handle *mcuCamGetSessionHandle(void);

/**
* @brief Sets the camera LED state.
* @param on Whether or not the camera LED should be turned on.
*/
Result MCUCAM_SetCameraLedState(bool on);

/**
* @brief Returns whether or not the camera LED is on.
* @param out_on Pointer to output whether or not the camera LED is on.
*/
Result MCUCAM_GetCameraLedState(bool *out_on);
25 changes: 25 additions & 0 deletions libctru/include/3ds/services/mcucdc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @file mcucdc.h
* @brief MCU CODEC service.
*/
#pragma once

#include <3ds/types.h>
#include <3ds/services/mcu_common.h>

/// Initializes mcuCdc.
Result mcuCdcInit(void);

/// Exits mcuCdc.
void mcuCdcExit(void);

/**
* @brief Gets the current mcuCdc session handle.
* @return A pointer to the current mcuCdc session handle.
*/
Handle *mcuCdcGetSessionHandle(void);

/**
* @brief Writes bit 4 to MCU register 26h.
*/
Result MCUCDC_SetReg26h();
106 changes: 106 additions & 0 deletions libctru/include/3ds/services/mcugpu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/**
* @file mcugpu.h
* @brief MCU GPU service.
*/
#pragma once

#include <3ds/types.h>
#include <3ds/services/mcu_common.h>

/// Initializes mcuGpu.
Result mcuGpuInit(void);

/// Exits mcuGpu.
void mcuGpuExit(void);

/**
* @brief Gets the current mcuGpu session handle.
* @return A pointer to the current mcuGpu session handle.
*/
Handle *mcuGpuGetSessionHandle(void);

/**
* @brief Returns whether the screen backlights are on.
* @param out_top_on Pointer to output whether or not the top screen backlight is on.
* @param out_bot_on Pointer to output whether or not the bottom screen backlight is on.
*/
Result MCUGPU_GetBacklightPower(bool *out_top_on, bool *out_bot_on);

/**
* @brief Turns the top/bottom screen backlights on/off.
* @param top_on Whether or not the top screen backlight should be turned on.
* @param bot_on Whether or not the bottom screen backlight should be turned on.
*/
Result MCUGPU_SetBacklightPower(bool top_on, bool bot_on);

/**
* @brief Returns whether the LCDs are on.
* @param out_on Pointer to output whether or not the LCDs are on.
*/
Result MCUGPU_GetLcdPower(bool *out_on);

/**
* @brief Turns the LCDs on/off.
* @param on Whether or not the LCDs should be turned on.
*/
Result MCUGPU_SetLcdPower(bool on);

/**
* @brief Sets the flicker (VCOM) value for the top screen.
* @param flicker The new value to use. Default value: 0x5C
*/
Result MCUGPU_SetTopLcdFlicker(u8 flicker);

/**
* @brief Gets the flicker (VCOM) value for the top screen.
* @param out_flicker Pointer to output the flicker value to.
*/
Result MCUGPU_GetTopLcdFlicker(u8 *out_flicker);

/**
* @brief Sets the flicker (VCOM) value for the bottom screen.
* @param flicker The new value to use. Default value: 0x5F
*/
Result MCUGPU_SetBottomLcdFlicker(u8 flicker);

/**
* @brief Gets the flicker (VCOM) value for the bottom screen.
* @param out_flicker Pointer to output the flicker value to.
*/
Result MCUGPU_GetBottomLcdFlicker(u8 *out_flicker);

/**
* @brief Gets the major MCU firmware version
* @param out Pointer to write the major firmware version to.
*/
Result MCUGPU_GetFwVerHigh(u8 *out);

/**
* @brief Gets the minor MCU firmware version
* @param out Pointer to write the minor firmware version to.
*/
Result MCUGPU_GetFwVerLow(u8 *out);

/**
* @brief Sets the 3D LED state.
* @param state State of 3D LED. (True/False)
*/
Result MCUGPU_Set3dLedState(bool state);

/**
* @brief Gets the 3D LED state.
* @param out_state Pointer to output whether or not the 3D LED is on.
*/
Result MCUGPU_Get3dLedState(bool *out_state);

/**
* @brief Gets the interrupt event handle for GPU interrupts.
* @param out_event Pointer to output the interrupt event handle to.
*/
Result MCUGPU_GetInterruptEventHandle(Handle *out_event);

/**
* @brief Reads the recently received GPU interrupts.
* @param out_irqs Pointer to output the received interrupts to.
*/
Result MCUGPU_GetReceivedInterrupts(u32 *out_irqs);
111 changes: 111 additions & 0 deletions libctru/include/3ds/services/mcuhid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* @file mcuhid.h
* @brief MCU HID service.
*/
#pragma once

#include <3ds/types.h>
#include <3ds/services/mcu_common.h>

/// Initializes mcuHid.
Result mcuHidInit(void);

/// Exits mcuHid.
void mcuHidExit(void);

/**
* @brief Gets the current mcuHid session handle.
* @return A pointer to the current mcuHid session handle.
*/
Handle *mcuHidGetSessionHandle(void);

/**
* @brief Enables or disables the accelerometer.
* @param enable Whether or not to enable the accelerometer.
*/
Result MCUHID_SetAccelerometerEnabled(bool enable);

/**
* @brief Returns whether or not the accelerometer is enabled.
* @param out_enabled Pointer to output whether or not the accelerometer is enabled.
*/
Result MCUHID_GetAccelerometerEnabled(bool *out_enabled);

/**
* @brief Starts a raw accelerometer I2C read operation.
* @param hw_regid The I2C register address to read from. Refer to the datasheet for the LIS331DLH IC for more information about the available registers.
*/
Result MCUHID_StartAccelerometerManualRead(u8 hw_regid);

/**
* @brief Gets the result of an raw accelerometer I2C read operation.
* @param out_data Pointer to output the read data byte to.
*/
Result MCUHID_GetAccelerometerManualReadResult(u8 *out_data);

/**
* @brief Performs a raw accelerometer I2C write operation.
* @param hw_regid The I2C register address to write to. Refer to the datasheet for the LIS331DLH IC for more information about the available registers.
* @param data The data byte to write to the given address.
*/
Result MCUHID_PerformAccelerometerManualWrite(u8 hw_regid, u8 data);

/**
* @brief Reads the current position data from the accelerometer.
* @param out_data Pointer to output the accelerometer data to.
*/
Result MCUHID_ReadAccelerometerData(MCU_AccelerometerData *out_data);

/**
* @brief Reads the current position of the 3D slider.
* @param out_pos Pointer to output the position to.
*/
Result MCUHID_Read3dSliderPosition(u8 *out_pos);

/**
* @brief Sets the scale of the accelerometer.
* @param scale The new scale to use.
*/
Result MCUHID_SetAccelerometerScale(MCU_AccelerometerScale scale);

/**
* @brief Gets the currently used scale of the accelerometer.
* @param out_scale Pointer to output the scale to.
*/
Result MCUHID_GetAccelerometerScale(MCU_AccelerometerScale *out_scale);

/**
* @brief Enables/disables the internal filter of the accelerometer. Refer to the datasheet for the LIS331DLH IC for more information.
* @param enabled Whether or not the filter should be enabled.
*/
Result MCUHID_SetAccelerometerInternalFilterEnabled(bool enabled);

/**
* @brief Returns whether or not the internal filter of the accelerometer is enabled. Refer to the datasheet for the LIS331DLH IC for more information.
* @param out_enabled Pointer to output the status to.
*/
Result MCUHID_GetAccelerometerInternalFilterEnabled(bool *out_enabled);

/**
* @brief Gets the interrupt event handle for HID interrupts.
* @param out_event Pointer to output the interrupt event handle to.
*/
Result MCUHID_GetInterruptEventHandle(Handle *out_handle);

/**
* @brief Reads the recently received HID interrupts.
* @param out_irqs Pointer to output the received interrupts to.
*/
Result MCUHID_GetReceivedInterrupts(u32 *out_irqs);

/**
* @brief Gets the volume slider level.
* @param level Pointer to write the slider level to.
*/
Result MCUHID_GetVolumeSliderLevel(u8 *level);

/**
* @brief Enables/disables the IRQ that fires whenever the accelerometer publishes a new sample.
* @param enable Whether or not to enable the IRQ.
*/
Result MCUHID_SetAccelerometerIrqEnabled(bool enable);
Loading