libnds
Loading...
Searching...
No Matches
Macros | Enumerations | Functions
camera.h File Reference

Camera functions for the ARM9. More...

#include <stdbool.h>
#include <stddef.h>

Macros

#define CAM_MCNT_PWR_18V_CORE   BIT(4)
 1.8V core voltage rail enable
 
#define CAM_MCNT_PWR_18V_IO   BIT(5)
 1.8V IO voltage rail enable
 
#define CAM_MCNT_PWR_28V   BIT(6)
 2.8V voltage rail enable
 
#define CAM_MCNT_READY   BIT(7)
 Ready status.
 

Enumerations

enum  CameraDevice {
  CAMERA_INNER = 0 ,
  CAMERA_OUTER = 1 ,
  CAMERA_NONE = 2
}
 Types of camera in a DSi. More...
 

Functions

bool cameraDeinit (void)
 Deinitializes the camera driver.
 
bool cameraInit (void)
 Initializes the camera driver.
 
bool cameraSelect (CameraDevice device)
 Selects the active camera.
 
bool cameraStartTransfer (u16 *buffer, u8 captureMode, u8 ndmaId)
 Starts a camera transfer using the specified NDMA channel.
 
static void cameraStopTransfer (void)
 Stops a camera transfer.
 
static bool cameraTransferActive (void)
 Checks if a camera transfer is active.
 

Detailed Description

Camera functions for the ARM9.

Enumeration Type Documentation

◆ CameraDevice

Types of camera in a DSi.

Enumerator
CAMERA_INNER 

Internal camera (facing the player)

CAMERA_OUTER 

External camera (facing away from the player)

CAMERA_NONE 

Don't select any camera.

Function Documentation

◆ cameraDeinit()

bool cameraDeinit ( void  )

Deinitializes the camera driver.

Returns
It returns true on success, false on failure.

◆ cameraInit()

bool cameraInit ( void  )

Initializes the camera driver.

Returns
It returns true on success, false on failure.

◆ cameraSelect()

bool cameraSelect ( CameraDevice  device)

Selects the active camera.

Parameters
deviceCamera to use (internal or external).
Returns
It returns true on success, false on failure.

◆ cameraStartTransfer()

bool cameraStartTransfer ( u16 buffer,
u8  captureMode,
u8  ndmaId 
)

Starts a camera transfer using the specified NDMA channel.

To check if the transfer is finished, use ndmaBusy() and cameraTransferActive(). If either of them is busy, the transfer is in progress.

Parameters
bufferBuffer where the captured image will be stored.
captureModeNormally MCUREG_APT_SEQ_CMD_PREVIEW or MCUREG_APT_SEQ_CMD_CAPTURE.
ndmaIdNDMA channel to use (0 - 3).
Returns
It returns true on success, false on failure.

◆ cameraStopTransfer()

static void cameraStopTransfer ( void  )
inlinestatic

Stops a camera transfer.

Call this function after the NDMA transfer has ended.

◆ cameraTransferActive()

static bool cameraTransferActive ( void  )
inlinestatic

Checks if a camera transfer is active.

Returns
Returns true if the transfer is active.