2.59 Breathing/Blinking LED

LEDs are used in computer applications to communicate internal state information to a user through a minimal interface.

Typical applications will cause an LED to blink at different rates to convey different state information. For example, an LED could be full on, full off, blinking at a rate of once a second, or blinking at a rate of once every four seconds, in order to communicate four different states.

As an alternative to blinking, an LED can “breathe”, that is, oscillate between a bright state and a dim state in a continuous, or apparently continuous manner. The rate of breathing, or the level of brightness at the extremes of the oscillation period, can be used to convey state information to the user that may be more informative, or at least more novel, than traditional blinking.

Using the Library

The LEDx_Initialize routine will set up the LED for the breathing action as configured using MCC. No additional APIs are typically needed to be called to achieve the breathing action.

Library Interface

LED peripheral library provides the following interfaces:

Functions

NameDescription
LEDx_InitializeInitializes given instance of LED peripheral.
LEDx_ClockPrescalerSetConfigures the prescaler for the PWM clock in LED blinking mode
LEDx_DutyCycleCountSetConfigures the duty cycle of the blink function in LED blinking mode
LEDx_DutyCycleMaxSetSpecifies the maximum duty cycle value.
LEDx_DutyCycleMinSetSpecifies the minimum duty cycle value.
LEDx_HighDelaySetSpecifies the number of PWM periods to wait before updating the current duty cycle when the current duty cycle is greater than or equal to the value MAX in register LED_LIMIT
LEDx_LowDelaySetSpecifies the number of PWM periods to wait before updating the current duty cycle when the current duty cycle is greater than or equal to the value MIN in register LED_LIMIT
LEDx_SegmentsIntervalSetConfigures the number of PWM periods between updates to current duty cycle
LEDx_SegmentsStepSizeSetConfigures the amount the current duty cycle is adjusted at the end of every PWM period
LEDx_SymmetrySetConfigures the LED rising and falling times in Asymmetric or Symmetric modes
LEDx_UpdateEnables update of LED Delay, LED Step and LED interval registers
LEDx_WDT_CallbackRegisterAllows application to register a callback with the LED WDT module
LEDx_WDTReloadCountSetConfigures the PWM WDT counter value

Data types and constants

NameTypeDescription
LED_WDT_CALLBACKTypedefDefines the data type and function signature for the LED WDT callback function.
LED_SYMEnumDefines the enumerations associated with LED symmetry modes
Note: Not all APIs maybe implemented. See the specific device family section for available APIs.