libnx
irs.h
Go to the documentation of this file.
1 /**
2  * @file irs.h
3  * @brief HID IR sensor (irs) service IPC wrapper.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 
9 #include "../types.h"
10 #include "../services/sm.h"
11 #include "../services/hid.h"
12 
13 typedef struct {
14  u64 unk_x0;
15  u8 unk_x8;
16  u8 unk_x9;
17  u8 unk_xa;
18  u8 pad[5];
19  u16 unk_x10;
20  u32 unk_x12;
21  u16 unk_x16;
22  u32 unk_constant;//offset 0x18
23  u8 unk_x1c;
24  u8 unk_x1d;
25  u8 pad2[2];
27 
28 typedef struct {
29  u64 exposure; ///< IR Sensor exposure time in nanoseconds.
30  u32 ir_leds; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
31  u32 digital_gain; ///< IR sensor signal's digital gain.
32  u8 color_invert; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
33  u8 pad[7];
34  u32 sensor_res; ///< IR Sensor resolution. 0: 240x320, 1: 120x160, 2: 60x80.
36 
37 typedef struct {
38  u64 exposure; ///< IR Sensor exposure time in nanoseconds.
39  u8 ir_leds; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
40  u8 digital_gain; ///< IR sensor signal's digital gain.
41  u8 color_invert; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
42  u8 pad[5];
43  u32 unk_constant;//offset 0x10
44  u8 sensor_res; ///< IR Sensor resolution. 0: 240x320, 1: 120x160, 2: 60x80.
45  u8 pad2[3];
47 
48 typedef struct {
49  u8 unk_x0[0x10];
51 
52 Result irsInitialize(void);
53 void irsExit(void);
54 
55 Service* irsGetSessionService(void);
56 void* irsGetSharedmemAddr(void);
57 
58 /// (De)activate the IR sensor, this is automatically used by irsExit(). Must be called after irsInitialize() to activate the IR sensor.
59 Result irsActivateIrsensor(bool activate);
60 
61 Result irsGetIrCameraHandle(u32 *IrCameraHandle, HidControllerID id);
62 
63 /**
64  * @brief Start ImageTransferProcessor.
65  * @param[in] IrCameraHandle Camera handle.
66  * @param[in] config Input config.
67  * @param[in] size Work-buffer size, must be 0x1000-byte aligned.
68  * @note Do not use if already started.
69  */
70 Result irsRunImageTransferProcessor(u32 IrCameraHandle, IrsImageTransferProcessorConfig *config, size_t size);
71 
72 Result irsGetImageTransferProcessorState(u32 IrCameraHandle, void* buffer, size_t size, IrsImageTransferProcessorState *state);
73 
74 /// Stop ImageTransferProcessor. Do not use if already stopped.
75 /// \ref irsExit calls this with all IrCameraHandles which were not already used with \ref irsStopImageProcessor.
76 Result irsStopImageProcessor(u32 IrCameraHandle);
77 
78 /// "Suspend" ImageTransferProcessor.
79 /// TODO: What does this really do?
80 Result irsSuspendImageProcessor(u32 IrCameraHandle);
81 
82 /**
83  * Gets the default configuration for Image Transfer mode.
84  * Defaults are exposure 300us, IR LEDs all ON, 8x digital gain, normal image and resolution 240 x 320.
85  */
u8 sensor_res
IR Sensor resolution. 0: 240x320, 1: 120x160, 2: 60x80.
Definition: irs.h:44
void irsGetDefaultImageTransferProcessorConfig(IrsImageTransferProcessorConfig *config)
Gets the default configuration for Image Transfer mode.
#define PACKED
Packs a struct (and other types?) so it won&#39;t include padding bytes.
Definition: types.h:56
uint16_t u16
16-bit unsigned integer.
Definition: types.h:22
u32 sensor_res
IR Sensor resolution. 0: 240x320, 1: 120x160, 2: 60x80.
Definition: irs.h:34
Service object structure.
Definition: sm.h:23
u32 Result
Function error code result type.
Definition: types.h:46
u8 color_invert
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:41
uint8_t u8
8-bit unsigned integer.
Definition: types.h:21
uint64_t u64
64-bit unsigned integer.
Definition: types.h:24
u8 digital_gain
IR sensor signal&#39;s digital gain.
Definition: irs.h:40
Definition: irs.h:48
uint32_t u32
32-bit unsigned integer.
Definition: types.h:23
u64 exposure
IR Sensor exposure time in nanoseconds.
Definition: irs.h:29
u32 ir_leds
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:30
Result irsRunImageTransferProcessor(u32 IrCameraHandle, IrsImageTransferProcessorConfig *config, size_t size)
Start ImageTransferProcessor.
u8 color_invert
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:32
Result irsActivateIrsensor(bool activate)
(De)activate the IR sensor, this is automatically used by irsExit(). Must be called after irsInitiali...
Result irsSuspendImageProcessor(u32 IrCameraHandle)
"Suspend" ImageTransferProcessor.
Definition: irs.h:13
u32 digital_gain
IR sensor signal&#39;s digital gain.
Definition: irs.h:31
u8 ir_leds
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:39
u64 exposure
IR Sensor exposure time in nanoseconds.
Definition: irs.h:38
Result irsStopImageProcessor(u32 IrCameraHandle)
Stop ImageTransferProcessor.