SLEEP LED

Sample List

This chapter introduces the details of the SLEEP LED sample code. The SDK provides the following samples for the SLEEP LED peripheral.

Functional Overview

SLEEP LED is used to control LED to make the effect of blinking light or breathing light.

Note

Feature List

  • Support three channels.

  • Support blink mode and breathe mode.

  • 32KHz clock source.

  • 3 periods per channel in blink mode.

  • 8 phases per channel in breathe mode.

  • Support output level setting high or low in idle state.

  • Support reverse output function.

  • Support period bypass in blink mode and phase bypass in breathe mode.

Block Diagram

Here is the overall IPs block diagram for SLEEP LED IP¹, which including ‘PAD/PINMUX’ for IO function configuration, ‘SLEEP LED IP’ for SLEEP LED protocol.

../../../_images/SLEEP_LED_System_Block_Diagram.png

System Block Diagram of SLEEP LED

Breathe Mode

In breathe mode, one channel is divided into eight phases. As shown in the following figure, it is executed sequentially from phase0, and after the end of phase7, it goes to phase0 to continue the loop execution.

../../../_images/Schematic_Diagram_of_SLEEP_LED_Breathe_Mode.png

Schematic Diagram of SLEEP LED Breathe Mode

Note

  1. phase_timetick = SLEEP_LED_InitTypeDef::prescale / 32000

  2. SLEEP_LED_InitTypeDef::phase_uptate_rate: duty update time = (SLEEP_LED_InitTypeDef::phase_uptate_rate + 1) * phase_timetick

  3. SLEEP_LED_InitTypeDef::phase_phase_tick: The duration of the whole phase. phase output time = SLEEP_LED_InitTypeDef::phase_phase_tick * phase_timetick

  4. SLEEP_LED_InitTypeDef::phase_initial_duty: initial high level time = SLEEP_LED_InitTypeDef::phase_initial_duty / 32000

  5. SLEEP_LED_InitTypeDef::phase_increase_duty: The direction of each change of duty. 1: increase duty. 0: decrease duty.

  6. SLEEP_LED_InitTypeDef::phase_duty_step: duty step time = SLEEP_LED_InitTypeDef::phase_duty_step / 32000

  7. After high level time increases to phase_timetick, it remains at phase_timetick.

  8. After high level time decreases to 0, it remains at 0.

  9. Low level time = phase_timetick - high level time

  10. If phase_phase_tick[x] (x = 0, 1, 2, …, 7) is 0, this and subsequent phases are bypassed. For example, if phase_phase_tick[6] is 0, phase6 and phase7 are bypassed, it is executed sequentially from phase0, and after the end of phase5, it goes to phase0 to continue the loop execution.

Idle State

Call the SleepLed_SetIdleMode() to set whether the channel outputs a high level or low level after the SLEEP LED is disabled.

Reverse Output Function

Each channel of SLEEP LED supports the reverse function. After the reverse function is enabled, the original waveform is reversed and output, the actual waveform is opposite to the set value. This function is configured by SLEEP_LED_InitTypeDef::polarity.

Power Manager

The SLEEP LED peripheral of RTL87x3E is located in the PON domain, it will be powered off in power down mode and ship mode. The SLEEP LED peripheral of RTL87x3D is located in the AON domain, it will be powered off in ship mode.

Troubleshooting