# PM GetLEDPattern*

## C Specification

      #include <nitro/spi.h>

      u32 PM_GetLEDPattern( PMLEDPattern* patternBuf );

      u32 PM_GetLEDPatternAsync( PMLEDStatus* patternBuf, PMCallback callback, void* arg );

## Description

This function gets the LED state of the console.

patternBuf is a buffer that stores the `PMLEDPattern` list type values. It takes a value that indicates the state of the LED when it is not NULL. It will take one of the following values:

`PM_LED_PATTERN_ON` | The LED is illuminated.
`PM_LED_PATTERN_BLINK_LOW` | The LED is blinking at a high speed.
`PM_LED_PATTERN_BLINK_HIGH` | The LED is blinking at a low speed.
`PM_LED_PATTERN_BLINK1` | The LED is repeating a lit/unlit pattern every 1 frame.
`PM_LED_PATTERN_BLINK2` | The LED is repeating a lit/unlit pattern every 2 frames.
`PM_LED_PATTERN_BLINK3` | The LED is repeating a lit/unlit pattern every 3 frames.
`PM_LED_PATTERN_BLINK4` | The LED is repeating a lit/unlit pattern every 4 frames.
`PM_LED_PATTERN_BLINK5` | The LED is repeating a lit/unlit pattern every 5 frames.
`PM_LED_PATTERN_BLINK6` | The LED is repeating a lit/unlit pattern every 6 frames.
`PM_LED_PATTERN_BLINK8` | The LED is repeating a lit/unlit pattern every 8 frames.
`PM_LED_PATTERN_BLINK10` | The LED is repeating a lit/unlit pattern every 10 frames.
`PM_LED_PATTERN_PATTERN1` | The LED is blinking in a predetermined pattern.
`PM_LED_PATTERN_PATTERN2` | The LED is blinking in a predetermined pattern.
`PM_LED_PATTERN_PATTERN3` | The LED is blinking in a predetermined pattern.

The "high speed blink" and "low speed blink" are blink features that are implemented on the hardware. Although the term "high speed" is used, the blinking speed is actually slower than the blinking speed that is caused by the software that repeats the lit/unlit pattern in a fixed number of frames.

This function uses PXI to sends the commands that perform the operations pertaining to ARM7. The ARM7 side that takes in those commands is executed by using PMIC. Therefore, the function is not called and immediately put to use. Synchronous type functions that wait until the operations have finished and asynchronous type functions that only send commands to ARM7 have been prepared, so please use them according to their purpose. (Function names that have Async attached are asynchronous functions.)

When an asynchronous function is called, the designated callback callback is called when the processing finishes on the ARM7 side. The callback type `PMCallback` is defined by

> `typedef void ( *PMCallback )( u32 result, void* arg );`

For the callback arguments, the first argument results indicate the command results. This will be either `PM_RESULT_SUCCESS` or `PM_RESULT_ERROR`.The second argument returns arg.

When using this function, be sure to initialize the PM library with `PM_Init()`. (Calling it once is enough. Also, when calling `OS_Init()`, it is not necessary to perform initialization since it is called from inside the PM library.)

## Arguments

`patternBuf` | The buffer that stores the value of the LED pattern to be obtained.
`callback` | The callback called when the command finishes.
`arg` | The arguments when the callback is called.

## Return Values

A return value of `PM_RESULT_SUCCESS` indicates that the execution of the command was a success (for synchronous functions). This return value also indicates that the command was successfully sent to the ARM7 processor (for asynchronous functions).

A return value of `PM_INVALID_COMMAND` indicates that the given arguments cannot be designated.

A return value of `PM_RESULT_ERROR` indicates that some sort of error has occurred on the ARM7 side.

## See Also

`PM_Init`

## Revision History

08/26/2004 Initial version