-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleds.h
More file actions
68 lines (48 loc) · 1.71 KB
/
leds.h
File metadata and controls
68 lines (48 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef LEDS_H
#define LEDS_H
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
/* Peripheral includes. */
#include "stm32f4_discovery.h"
#include "stm32f4xx_tim.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_dma.h"
#include "stm32f4xx_tim.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_rng.h"
/* User includes */
#include "debug.h"
/*-----------------------------------------------------------*/
/* Defines for the SK6812 LEDs. */
#define NUMBER_OF_LEDS 144
/* Number of color channels */
#define COLOR_CHANNELS 3
/* 52 cycles * (1 sec / 42,000,000 cycle ) = 1.25 usec */
#define CLOCK_THRESH ( 52 )
/* 13 cycles * (1 sec / 42,000,000 cycles) = 0.309 usec */
#define LOW_THRESH ( 13 )
/* 50 cycles * (1 sec / 42,000,000 cycles) = 0.595 usec*/
#define HIGH_THRESH ( 25 )
/* 3360 cycles * (1 sec / 42,000,000 cycles) = 80.0 usec */
#define RESET_CYCLES ( 3360 )
/* RESET_CYCLES / CLOCK_THRESH = 64 */
#define RESET_PERIODS 65
/* Number of PWM periods to send a whole LED strip.
Number of LEDs * (Color Channels / LED) * (Bits / Color Channel) */
#define LED_PERIODS (NUMBER_OF_LEDS * COLOR_CHANNELS * 8)
/* Total nuumber of periods to send the entire LED strip */
#define TOTAL_PERIODS (LED_PERIODS + RESET_PERIODS)
/*-----------------------------------------------------------*/
/* Function for initializing the hardware to talk to the LEDs. */
void vInitLeds( void );
/* Task for updating the LED strip. */
void vUpdateLedStrip( void * );
/* Function for getting a random number. */
uint32_t ulGetRandVal( void );
/*-----------------------------------------------------------*/
/* Get debug stats from other file (debug.c) */
extern xDebugStats_t xDebugStats;
#endif