NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ledstrip.c File Reference
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <platform.h>
#include <build_config.h>
#include <common/color.h>
#include <common/maths.h>
#include <common/typeconversion.h>
#include <common/printf.h>
#include <common/axis.h>
#include <common/utils.h>
#include "drivers/light_ws2811strip.h"
#include "drivers/system.h"
#include "drivers/serial.h"
#include "io/ledstrip.h"
#include "config/config.h"
#include "config/feature.h"
#include "rx/rx.h"
Include dependency graph for ledstrip.c:

Macros

#define LED_STRIP_HZ(hz)   ((int32_t)((1000 * 1000) / (hz)))
 
#define LED_STRIP_MS(ms)   ((int32_t)(1000 * (ms)))
 
#define HSV(color)   (hsv[COLOR_ ## color])
 
#define INDICATOR_DEADBAND   25
 
#define ROTATION_SEQUENCE_LED_COUNT   6
 
#define ROTATION_SEQUENCE_LED_WIDTH   2
 

Typedefs

typedef void applyLayerFn_timed (struct ledstrip *self, bool updateNow, uint32_t *timer)
 
typedef void applyLayerFn (struct ledstrip *self)
 

Enumerations

enum  quadrant_e {
  QUADRANT_NORTH = 1 << 0, QUADRANT_SOUTH = 1 << 1, QUADRANT_EAST = 1 << 2, QUADRANT_WEST = 1 << 3,
  QUADRANT_NORTH_EAST = 1 << 4, QUADRANT_SOUTH_EAST = 1 << 5, QUADRANT_NORTH_WEST = 1 << 6, QUADRANT_SOUTH_WEST = 1 << 7,
  QUADRANT_NONE = 1 << 8, QUADRANT_NOTDIAG = 1 << 9, QUADRANT_ANY = QUADRANT_NORTH | QUADRANT_SOUTH | QUADRANT_EAST | QUADRANT_WEST | QUADRANT_NONE
}
 
enum  warningFlags_e { WARNING_ARMING_DISABLED, WARNING_LOW_BATTERY, WARNING_FAILSAFE }
 
enum  timId_e {
  timIndicator, timBlink, timWarning, timRotation,
  timTimerCount
}
 

Functions

void ledstrip_reload_config (struct ledstrip *self)
 Currently reloads config from the global store TODO: pass config to init! More...
 
void ledstrip_update (struct ledstrip *self)
 
void ledstrip_init (struct ledstrip *self, const struct config const *config, const struct system_calls *system, struct rx *rx, struct failsafe *failsafe)
 
void ledstrip_enable (struct ledstrip *self)
 
void ledstrip_disable (struct ledstrip *self)
 

Variables

const hsvColor_t hsv []
 

Macro Definition Documentation

#define HSV (   color)    (hsv[COLOR_ ## color])
#define INDICATOR_DEADBAND   25
#define LED_STRIP_HZ (   hz)    ((int32_t)((1000 * 1000) / (hz)))
#define LED_STRIP_MS (   ms)    ((int32_t)(1000 * (ms)))
#define ROTATION_SEQUENCE_LED_COUNT   6
#define ROTATION_SEQUENCE_LED_WIDTH   2

Typedef Documentation

typedef void applyLayerFn(struct ledstrip *self)
typedef void applyLayerFn_timed(struct ledstrip *self, bool updateNow, uint32_t *timer)

Enumeration Type Documentation

enum quadrant_e
Enumerator
QUADRANT_NORTH 
QUADRANT_SOUTH 
QUADRANT_EAST 
QUADRANT_WEST 
QUADRANT_NORTH_EAST 
QUADRANT_SOUTH_EAST 
QUADRANT_NORTH_WEST 
QUADRANT_SOUTH_WEST 
QUADRANT_NONE 
QUADRANT_NOTDIAG 
QUADRANT_ANY 
enum timId_e
Enumerator
timIndicator 
timBlink 
timWarning 
timRotation 
timTimerCount 
Enumerator
WARNING_ARMING_DISABLED 
WARNING_LOW_BATTERY 
WARNING_FAILSAFE 

Function Documentation

void ledstrip_disable ( struct ledstrip self)

Here is the call graph for this function:

void ledstrip_enable ( struct ledstrip self)

Here is the call graph for this function:

void ledstrip_init ( struct ledstrip self,
const struct config const *  config,
const struct system_calls system,
struct rx rx,
struct failsafe failsafe 
)
void ledstrip_reload_config ( struct ledstrip self)

Currently reloads config from the global store TODO: pass config to init!

void ledstrip_update ( struct ledstrip self)

Here is the call graph for this function:

Variable Documentation

applyLayerFn* apply
applyLayerFn_timed* applyTimed
uint8_t dir
union { ... } f
const hsvColor_t hsv[]
Initial value:
= {
[COLOR_BLACK] = { 0, 0, 0},
[COLOR_WHITE] = { 0, 255, 255},
[COLOR_RED] = { 0, 0, 255},
[COLOR_ORANGE] = { 30, 0, 255},
[COLOR_YELLOW] = { 60, 0, 255},
[COLOR_LIME_GREEN] = { 90, 0, 255},
[COLOR_GREEN] = {120, 0, 255},
[COLOR_MINT_GREEN] = {150, 0, 255},
[COLOR_CYAN] = {180, 0, 255},
[COLOR_LIGHT_BLUE] = {210, 0, 255},
[COLOR_BLUE] = {240, 0, 255},
[COLOR_DARK_VIOLET] = {270, 0, 255},
[COLOR_MAGENTA] = {300, 0, 255},
[COLOR_DEEP_PINK] = {330, 0, 255},
}
Definition: ledstrip.h:67
Definition: ledstrip.h:71
Definition: ledstrip.h:73
Definition: ledstrip.h:69
Definition: ledstrip.h:76
Definition: ledstrip.h:68
Definition: ledstrip.h:70
Definition: ledstrip.h:66
Definition: ledstrip.h:74
Definition: ledstrip.h:72
Definition: ledstrip.h:77
Definition: ledstrip.h:79
Definition: ledstrip.h:75
Definition: ledstrip.h:78
uint16_t quadrantMask
int8_t timId