libctru  v2.4.1
mcuhwc.h
Go to the documentation of this file.
1 /**
2  * @file mcuhwc.h
3  * @brief mcuHwc service.
4  */
5 #pragma once
6 
7 typedef enum {
8  LED_NORMAL = 1, ///< The normal mode of the led
9  LED_SLEEP_MODE, ///< The led pulses slowly as it does in the sleep mode
10  LED_OFF, ///< Switch off power led
11  LED_RED, ///< Red state of the led
12  LED_BLUE, ///< Blue state of the led
13  LED_BLINK_RED, ///< Blinking red state of power led and notification led
15 
16 typedef struct InfoLedPattern
17 {
18  u8 delay; ///< Delay between pattern values, 1/16th of a second (1 second = 0x10)
19  u8 smoothing; ///< Smoothing between pattern values (higher = smoother)
20  u8 loopDelay; ///< Delay between pattern loops, 1/16th of a second (1 second = 0x10, 0xFF = pattern is played only once)
21  u8 blinkSpeed; ///< Blink speed, when smoothing == 0x00
22  u8 redPattern[32]; ///< Pattern for red component
23  u8 greenPattern[32]; ///< Pattern for green component
24  u8 bluePattern[32]; ///< Pattern for blue component
26 
27 /// Initializes mcuHwc.
29 
30 /// Exits mcuHwc.
31 void mcuHwcExit(void);
32 
33 /**
34  * @brief Gets the current mcuHwc session handle.
35  * @return A pointer to the current mcuHwc session handle.
36  */
38 
39 /**
40  * @brief Reads data from an i2c device3 register
41  * @param reg Register number. See https://www.3dbrew.org/wiki/I2C_Registers#Device_3 for more info
42  * @param data Pointer to write the data to.
43  * @param size Size of data to be read
44  */
45 Result MCUHWC_ReadRegister(u8 reg, void *data, u32 size);
46 
47 /**
48  * @brief Writes data to a i2c device3 register
49  * @param reg Register number. See https://www.3dbrew.org/wiki/I2C_Registers#Device_3 for more info
50  * @param data Pointer to write the data to.
51  * @param size Size of data to be written
52  */
53 Result MCUHWC_WriteRegister(u8 reg, const void *data, u32 size);
54 
55 /**
56  * @brief Gets the battery voltage
57  * @param voltage Pointer to write the battery voltage to.
58  */
60 
61 /**
62  * @brief Gets the battery level
63  * @param level Pointer to write the current battery level to.
64  */
66 
67 /**
68  * @brief Gets the sound slider level
69  * @param level Pointer to write the slider level to.
70  */
72 
73 /**
74  * @brief Sets Wifi LED state
75  * @param state State of Wifi LED. (True/False)
76  */
78 
79 /**
80  * @brief Sets the notification LED pattern
81  * @param pattern Pattern for the notification LED.
82  */
84 
85 /**
86  * @brief Sets Power LED state
87  * @param state powerLedState State of power LED.
88  */
90 
91 /**
92  * @brief Gets 3d slider level
93  * @param level Pointer to write 3D slider level to.
94  */
96 
97 /**
98  * @brief Gets the major MCU firmware version
99  * @param out Pointer to write the major firmware version to.
100  */
102 
103 /**
104  * @brief Gets the minor MCU firmware version
105  * @param out Pointer to write the minor firmware version to.
106  */
Result MCUHWC_ReadRegister(u8 reg, void *data, u32 size)
Reads data from an i2c device3 register.
Result MCUHWC_GetBatteryLevel(u8 *level)
Gets the battery level.
Result MCUHWC_GetFwVerLow(u8 *out)
Gets the minor MCU firmware version.
Result mcuHwcInit(void)
Initializes mcuHwc.
powerLedState
Definition: mcuhwc.h:7
@ LED_NORMAL
The normal mode of the led.
Definition: mcuhwc.h:8
@ LED_BLINK_RED
Blinking red state of power led and notification led.
Definition: mcuhwc.h:13
@ LED_BLUE
Blue state of the led.
Definition: mcuhwc.h:12
@ LED_RED
Red state of the led.
Definition: mcuhwc.h:11
@ LED_SLEEP_MODE
The led pulses slowly as it does in the sleep mode.
Definition: mcuhwc.h:9
@ LED_OFF
Switch off power led.
Definition: mcuhwc.h:10
Result MCUHWC_WriteRegister(u8 reg, const void *data, u32 size)
Writes data to a i2c device3 register.
Result MCUHWC_SetPowerLedState(powerLedState state)
Sets Power LED state.
Result MCUHWC_GetSoundSliderLevel(u8 *level)
Gets the sound slider level.
Result MCUHWC_SetInfoLedPattern(const InfoLedPattern *pattern)
Sets the notification LED pattern.
Result MCUHWC_GetBatteryVoltage(u8 *voltage)
Gets the battery voltage.
Result MCUHWC_GetFwVerHigh(u8 *out)
Gets the major MCU firmware version.
Result MCUHWC_Get3dSliderLevel(u8 *level)
Gets 3d slider level.
Handle * mcuHwcGetSessionHandle(void)
Gets the current mcuHwc session handle.
Result MCUHWC_SetWifiLedState(bool state)
Sets Wifi LED state.
void mcuHwcExit(void)
Exits mcuHwc.
Definition: mcuhwc.h:17
u8 delay
Delay between pattern values, 1/16th of a second (1 second = 0x10)
Definition: mcuhwc.h:18
u8 loopDelay
Delay between pattern loops, 1/16th of a second (1 second = 0x10, 0xFF = pattern is played only once)
Definition: mcuhwc.h:20
u8 blinkSpeed
Blink speed, when smoothing == 0x00.
Definition: mcuhwc.h:21
u8 greenPattern[32]
Pattern for green component.
Definition: mcuhwc.h:23
u8 bluePattern[32]
Pattern for blue component.
Definition: mcuhwc.h:24
u8 redPattern[32]
Pattern for red component.
Definition: mcuhwc.h:22
u8 smoothing
Smoothing between pattern values (higher = smoother)
Definition: mcuhwc.h:19
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
u32 Handle
Resource handle.
Definition: types.h:41
s32 Result
Function result.
Definition: types.h:42
uint32_t u32
32-bit unsigned integer
Definition: types.h:23