Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_led

Driver for generic LED. More...

Data Structures

struct  bc_led_driver_t
 LED driver interface. More...
 

Typedefs

typedef struct bc_led_t bc_led_t
 LED instance.
 

Enumerations

enum  bc_led_mode_t {
  BC_LED_MODE_TOGGLE = 0,
  BC_LED_MODE_OFF = 1,
  BC_LED_MODE_ON = 2,
  BC_LED_MODE_BLINK = 3,
  BC_LED_MODE_BLINK_SLOW = 4,
  BC_LED_MODE_BLINK_FAST = 5,
  BC_LED_MODE_FLASH = 6
}
 LED modes. More...
 

Functions

void bc_led_init (bc_led_t *self, bc_gpio_channel_t gpio_channel, bool open_drain_output, int idle_state)
 Initialize LED. More...
 
void bc_led_init_virtual (bc_led_t *self, int channel, const bc_led_driver_t *driver, int idle_state)
 Initialize virtual LED. More...
 
void bc_led_set_slot_interval (bc_led_t *self, bc_tick_t interval)
 Set slot interval for pattern processing. More...
 
void bc_led_set_mode (bc_led_t *self, bc_led_mode_t mode)
 Set LED mode. More...
 
void bc_led_set_pattern (bc_led_t *self, uint32_t pattern)
 Set custom blinking pattern. More...
 
void bc_led_set_count (bc_led_t *self, int count)
 Set count for blinking pattern executed. More...
 
void bc_led_blink (bc_led_t *self, int count)
 LED blink. More...
 
void bc_led_pulse (bc_led_t *self, bc_tick_t duration)
 Turn on LED for the specified duration of time. More...
 
bool bc_led_is_pulse (bc_led_t *self)
 Check if there is ongoing LED pulse. More...
 

Detailed Description

Driver for generic LED.

How to use this driver

#include <bc_led.h>
void application_init(void)
{
bc_led_init(&led, BC_GPIO_LED, false, false);
}

Enumeration Type Documentation

LED modes.

Enumerator
BC_LED_MODE_TOGGLE 

LED toggles between on/off state (this has no effect while processing alternating patterns)

BC_LED_MODE_OFF 

LED has steady off state.

BC_LED_MODE_ON 

LED has steady on state.

BC_LED_MODE_BLINK 

LED blinks.

BC_LED_MODE_BLINK_SLOW 

LED blinks slowly.

BC_LED_MODE_BLINK_FAST 

LED blinks quickly.

BC_LED_MODE_FLASH 

LED flashes repeatedly.

Definition at line 25 of file bc_led.h.

Function Documentation

void bc_led_blink ( bc_led_t self,
int  count 
)

LED blink.

Parameters
[in]selfInstance
[in]countCount of blink

Definition at line 178 of file bc_led.c.

Here is the call graph for this function:

void bc_led_init ( bc_led_t self,
bc_gpio_channel_t  gpio_channel,
bool  open_drain_output,
int  idle_state 
)

Initialize LED.

Parameters
[in]selfInstance
[in]gpio_channelGPIO channel LED is connected to
[in]open_drain_outputDetermines if LED is driven by open-drain output
[in]idle_stateGPIO pin idle state (when LED is supposed to be off)

Definition at line 20 of file bc_led.c.

Here is the call graph for this function:

void bc_led_init_virtual ( bc_led_t self,
int  channel,
const bc_led_driver_t driver,
int  idle_state 
)

Initialize virtual LED.

Parameters
[in]selfInstance
[in]channelVirtual channel LED is connected to
[in]driverVirtual channel LED driver
[in]idle_stateVirtual pin idle state (when LED is supposed to be off)

Definition at line 50 of file bc_led.c.

Here is the call graph for this function:

bool bc_led_is_pulse ( bc_led_t self)

Check if there is ongoing LED pulse.

Parameters
[in]selfInstance
Returns
true If pulse is now active
false If pulse is now inactive

Definition at line 201 of file bc_led.c.

void bc_led_pulse ( bc_led_t self,
bc_tick_t  duration 
)

Turn on LED for the specified duration of time.

Parameters
[in]selfInstance
[in]durationDuration for which LED will be turned on

Definition at line 189 of file bc_led.c.

Here is the call graph for this function:

void bc_led_set_count ( bc_led_t self,
int  count 
)

Set count for blinking pattern executed.

Parameters
[in]selfInstance
[in]countCount for blinking pattern executed, negative value means infinity

Definition at line 173 of file bc_led.c.

void bc_led_set_mode ( bc_led_t self,
bc_led_mode_t  mode 
)

Set LED mode.

Parameters
[in]selfInstance
[in]modeDesired LED mode

Definition at line 74 of file bc_led.c.

Here is the call graph for this function:

void bc_led_set_pattern ( bc_led_t self,
uint32_t  pattern 
)

Set custom blinking pattern.

Parameters
[in]selfInstance
[in]patternBlinking pattern (bits with log. 1 represent active slot)

Definition at line 164 of file bc_led.c.

Here is the call graph for this function:

void bc_led_set_slot_interval ( bc_led_t self,
bc_tick_t  interval 
)

Set slot interval for pattern processing.

Parameters
[in]selfInstance
[in]intervalDesired slot interval in ticks

Definition at line 69 of file bc_led.c.