| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Data Structures | Macros | Functions
LED softblink
SDK common libraries

Module for generating a changing pulse-width modulated output signal that is used to smoothly blink LEDs. More...

## Modules
| led_softblink module configuration

## Data Structures
struct | led_sb_init_params_t
| Structure holding the initialization parameters. More...

## Macros
#define | LED_SB_INIT_DEFAULT_PARAMS(mask)
| LED softblink default configuration. More...

## Functions
ret_code_t | led_softblink_init (led_sb_init_params_t *p_init_params)
| Function for initializing LED softblink. More...
ret_code_t | led_softblink_start (uint32_t leds_pin_bit_mask)
| Function for starting to blink LEDs. More...
ret_code_t | led_softblink_stop (void)
| Function for stopping to blink LEDs. More...
void | led_softblink_off_time_set (uint32_t off_time_ticks)
| Function for setting the off time. More...
void | led_softblink_on_time_set (uint32_t on_time_ticks)
| Function for setting the on time. More...
ret_code_t | led_softblink_uninit (void)
| Function for uninitializing LED softblink. More...

## Default settings
Default settings for LED softblink.
#define | LED_SB_INIT_PARAMS_ACTIVE_HIGH false
#define | LED_SB_INIT_PARAMS_DUTY_CYCLE_MAX 220
#define | LED_SB_INIT_PARAMS_DUTY_CYCLE_MIN 0
#define | LED_SB_INIT_PARAMS_DUTY_CYCLE_STEP 5
#define | LED_SB_INIT_PARAMS_OFF_TIME_TICKS 65536
#define | LED_SB_INIT_PARAMS_ON_TIME_TICKS 0
#define | LED_SB_INIT_PARAMS_LEDS_PIN_BM(mask) (mask)

## Detailed Description

Module for generating a changing pulse-width modulated output signal that is used to smoothly blink LEDs.

This module provides an LED softblink implementation using timers and GPIO.

LED softblink needs one timer. It can use any number of output channels that are available.

Only one instance of LED softblink can run at a time.

## Macro Definition Documentation

#define LED_SB_INIT_DEFAULT_PARAMS | ( |  | mask | ) |

Value:
{ \
.active_high = LED_SB_INIT_PARAMS_ACTIVE_HIGH, \
.duty_cycle_max = LED_SB_INIT_PARAMS_DUTY_CYCLE_MAX, \
.duty_cycle_min = LED_SB_INIT_PARAMS_DUTY_CYCLE_MIN, \
.duty_cycle_step = LED_SB_INIT_PARAMS_DUTY_CYCLE_STEP, \
.off_time_ticks = LED_SB_INIT_PARAMS_OFF_TIME_TICKS, \
.on_time_ticks = LED_SB_INIT_PARAMS_ON_TIME_TICKS, \
.leds_pin_bm = LED_SB_INIT_PARAMS_LEDS_PIN_BM(mask) \
}

LED softblink default configuration.

## Function Documentation

ret_code_t led_softblink_init | ( | led_sb_init_params_t * | p_init_params | ) |

Function for initializing LED softblink.

Parameters

  [in] | p_init_params | Pointer to the initialization structure.

Returns
  Values returned by app_timer_create.

void led_softblink_off_time_set | ( | uint32_t | off_time_ticks | ) |

Function for setting the off time.

This function configures the time that the LEDs will be off between each blink.

Parameters

  [in] | off_time_ticks | Off time in ticks.

void led_softblink_on_time_set | ( | uint32_t | on_time_ticks | ) |

Function for setting the on time.

This function configures the time that the LEDs will be on between each blink.

Parameters

  [in] | on_time_ticks | On time in ticks.

ret_code_t led_softblink_start | ( | uint32_t | leds_pin_bit_mask | ) |

Function for starting to blink LEDs.

Parameters

  [in] | leds_pin_bit_mask | Bit mask containing the pins for the LEDs to be blinked.

Returns
  Values returned by app_timer_start.

ret_code_t led_softblink_stop | ( | void |  | ) |

Function for stopping to blink LEDs.

Returns
  Values returned by app_timer_stop.

ret_code_t led_softblink_uninit | ( | void |  | ) |

Function for uninitializing LED softblink.

Return values

  NRF_SUCCESS | If LED softblink was uninitialized successfully.