Add MCUHWC_SetInfoLedPattern (#549)
This commit is contained in:
parent
cc5b884d7d
commit
5f06a037d7
@ -4,15 +4,25 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
|
LED_NORMAL = 1, ///< The normal mode of the led
|
||||||
|
LED_SLEEP_MODE, ///< The led pulses slowly as it does in the sleep mode
|
||||||
|
LED_OFF, ///< Switch off power led
|
||||||
|
LED_RED, ///< Red state of the led
|
||||||
|
LED_BLUE, ///< Blue state of the led
|
||||||
|
LED_BLINK_RED, ///< Blinking red state of power led and notification led
|
||||||
|
} powerLedState;
|
||||||
|
|
||||||
|
typedef struct InfoLedPattern
|
||||||
{
|
{
|
||||||
LED_NORMAL = 1, ///< The normal mode of the led
|
u8 delay; ///< Delay between pattern values, 1/16th of a second (1 second = 0x10)
|
||||||
LED_SLEEP_MODE, ///< The led pulses slowly as it does in the sleep mode
|
u8 smoothing; ///< Smoothing between pattern values (higher = smoother)
|
||||||
LED_OFF, ///< Switch off power led
|
u8 loopDelay; ///< Delay between pattern loops, 1/16th of a second (1 second = 0x10, 0xFF = pattern is played only once)
|
||||||
LED_RED, ///< Red state of the led
|
u8 blinkSpeed; ///< Blink speed, when smoothing == 0x00
|
||||||
LED_BLUE, ///< Blue state of the led
|
u8 redPattern[32]; ///< Pattern for red component
|
||||||
LED_BLINK_RED, ///< Blinking red state of power led and notification led
|
u8 greenPattern[32]; ///< Pattern for green component
|
||||||
}powerLedState;
|
u8 bluePattern[32]; ///< Pattern for blue component
|
||||||
|
} InfoLedPattern;
|
||||||
|
|
||||||
/// Initializes mcuHwc.
|
/// Initializes mcuHwc.
|
||||||
Result mcuHwcInit(void);
|
Result mcuHwcInit(void);
|
||||||
@ -66,6 +76,12 @@ Result MCUHWC_GetSoundSliderLevel(u8 *level);
|
|||||||
*/
|
*/
|
||||||
Result MCUHWC_SetWifiLedState(bool state);
|
Result MCUHWC_SetWifiLedState(bool state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the notification LED pattern
|
||||||
|
* @param pattern Pattern for the notification LED.
|
||||||
|
*/
|
||||||
|
Result MCUHWC_SetInfoLedPattern(const InfoLedPattern* pattern);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets Power LED state
|
* @brief Sets Power LED state
|
||||||
* @param state powerLedState State of power LED.
|
* @param state powerLedState State of power LED.
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/svc.h>
|
#include <3ds/svc.h>
|
||||||
#include <3ds/synchronization.h>
|
#include <3ds/synchronization.h>
|
||||||
@ -114,6 +115,22 @@ Result MCUHWC_SetWifiLedState(bool state)
|
|||||||
return (Result)cmdbuf[1];
|
return (Result)cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result MCUHWC_SetInfoLedPattern(const InfoLedPattern* pattern)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x0A,25,0); // 0xA0640
|
||||||
|
cmdbuf[1] = ((u32)pattern->blinkSpeed << 24) | ((u32)pattern->loopDelay << 16) | ((u32)pattern->smoothing << 8) | pattern->delay;
|
||||||
|
memcpy(&cmdbuf[2], pattern->redPattern, sizeof(pattern->redPattern));
|
||||||
|
memcpy(&cmdbuf[10], pattern->greenPattern, sizeof(pattern->greenPattern));
|
||||||
|
memcpy(&cmdbuf[18], pattern->bluePattern, sizeof(pattern->bluePattern));
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(mcuHwcHandle))) return ret;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
Result MCUHWC_GetSoundSliderLevel(u8 *level)
|
Result MCUHWC_GetSoundSliderLevel(u8 *level)
|
||||||
{
|
{
|
||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user