PMi_SetLEDPattern*

# PM_SetLEDPattern*

## C Specification

      #include <nitro/spi.h>

      u32 PM_SetLEDPattern( PMLEDPattern pattern );

      u32 PM_SetLEDPatternAsync( PMLEDPattern pattern, PMCallback callback, void* arg );

## Description

This function configures the state of the LED pattern for the console.

CAUTION: The state of the LED is set by guidelines. Do not perform configurations outside these guidelines. You should avoid using this function to make changes to the LED configuration. (The necessary sections are automatically configured by the PM library.)

pattern is a `PMLEDPattern` list type value. Designate it using 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 blinks every 1 frame.
`PM_LED_PATTERN_BLINK2` | The LED blinks every 2 frames.
`PM_LED_PATTERN_BLINK3` | The LED blinks every 3 frames.
`PM_LED_PATTERN_BLINK4` | The LED blinks every 4 frames.
`PM_LED_PATTERN_BLINK5` | The LED blinks every 5 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.

This function uses PXI to send the commands that perform operations that pertain to the ARM7 processor. The ARM7 side that takes in those commands is executed by the PMIC. Therefore, the function is not called and immediately put to use.

Synchronous type functions wait until the operations have finished. Asynchronous type functions only send commands to the ARM7 processor. Use these functions according to their intended 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.The command results will be either `PM_RESULT_SUCCESS` or `PM_RESULT_ERROR`.The second argument return the 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

`pattern` | The LED pattern state to configure
`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 sending of the command to the ARM7 processor was a success (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`, `PM_GetLEDPattern`,

## Revision History

08/26/2004 Initial version