1.1.6 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

Functions
Name Description
LEDx_Initialize Initializes given instance of LED peripheral.
LEDx_ClockPrescalerSet Configures the prescaler for the PWM clock in LED blinking mode
LEDx_DutyCycleCountSet Configures the duty cycle of the blink function in LED blinking mode
LEDx_DutyCycleMaxSet Specifies the maximum duty cycle value.
LEDx_DutyCycleMinSet Specifies the minimum duty cycle value.
LEDx_HighDelaySet Specifies 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_LowDelaySet Specifies 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_SegmentsIntervalSet Configures the number of PWM periods between updates to current duty cycle
LEDx_SegmentsStepSizeSet Configures the amount the current duty cycle is adjusted at the end of every PWM period
LEDx_SymmetrySet Configures the LED rising and falling times in Asymmetric or Symmetric modes
LEDx_Update Enables update of LED Delay, LED Step and LED interval registers
LEDx_WDT_CallbackRegister Allows application to register a callback with the LED WDT module
LEDx_WDTReloadCountSet Configures the PWM WDT counter value
Data types and constants
Name Type Description
LED_WDT_CALLBACK Typedef Defines the data type and function signature for the LED WDT callback function.
LED_SYM Enum Defines the enumerations associated with LED symmetry modes