Voss Connection Detection  1
Detect a connector click using realtime code on Bela hardware
Leds Class Reference

Let physical LEDs burn, blink or blink once. More...

#include <leds.h>

Public Types

enum  Led { wrist = 0, thumb = 1, vibrator = 2, controlbox = 3 }
 Led enumeration. More...
 
enum  LedState { off = 0, on = 1, blink_permanent = 3, blink_once = 4 }
 A state in which a certain LED can be set. More...
 

Public Member Functions

 Leds (BelaContext *ctx)
 Initialize LED controller and state machine. More...
 
void setState (Led led, LedState ledstate, float period=LED_HOLD_TIME, float dutycycle=0.5)
 Set a certain LED in a certain state. The state blink_once will - after it has blinked - automatically go back to state off. Note that setState does nothing in case the led is already in the state that setState wants it to set. More...
 
LedState getState (Led led) const
 Get the current led state. More...
 
void processBuf (BelaContext *ctx)
 Run this function in render. More...
 
void processFrame (BelaContext *ctx, us frame)
 

Detailed Description

Let physical LEDs burn, blink or blink once.

Definition at line 15 of file leds.h.

Member Enumeration Documentation

◆ Led

enum Leds::Led

Led enumeration.

Enumerator
wrist 

Led on wrist.

thumb 

Led on thumb.

vibrator 

The vibrator, which is not really an LED but can be controlled the same way.

controlbox 

Control box led.

Definition at line 22 of file leds.h.

◆ LedState

A state in which a certain LED can be set.

Enumerator
off 

No light.

on 

Burn permanently.

blink_permanent 

Blink all the time.

blink_once 

Blink once.

Definition at line 44 of file leds.h.

Constructor & Destructor Documentation

◆ Leds()

Leds::Leds ( BelaContext *  ctx)

Initialize LED controller and state machine.

Parameters
ctxBelaContext

Definition at line 6 of file leds.cpp.

Member Function Documentation

◆ getState()

LedState Leds::getState ( Led  led) const
inline

Get the current led state.

Parameters
led
Returns
Its state

Definition at line 91 of file leds.h.

◆ processBuf()

void Leds::processBuf ( BelaContext *  ctx)

Run this function in render.

Parameters
ctxBelaContext

Definition at line 57 of file leds.cpp.

◆ processFrame()

void Leds::processFrame ( BelaContext *  ctx,
us  frame 
)

Definition at line 71 of file leds.cpp.

◆ setState()

void Leds::setState ( Led  led,
LedState  ledstate,
float  period = LED_HOLD_TIME,
float  dutycycle = 0.5 
)

Set a certain LED in a certain state. The state blink_once will - after it has blinked - automatically go back to state off. Note that setState does nothing in case the led is already in the state that setState wants it to set.

Parameters
ledThe led to set
ledstateThe state to set the state in.
periodThe period, in seconds in case of blink_permanent (total time of a cycle), in case of blink_once, the time that it should be on.
dutycycleIn case of blink_permanent, the time that it is on.

Definition at line 79 of file leds.cpp.


The documentation for this class was generated from the following files: