generated from pimoroni/pico-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
97 lines (75 loc) · 3.1 KB
/
config.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef CONFIG_H
#define CONFIG_H
#include "ledcontrol.h"
#include <cstdint>
#include <cstdio>
#include <cmath>
using namespace ledcontrol;
using namespace plasma;
// Adjust according to the number of LEDs you have
const uint NUM_LEDS = 151;
// Set this if the LED strip you use is RGBW
const bool LED_RGBW = true;
//const bool LED_RGBW = false;
// Change this if the colour order of your LED strip is different
const WS2812::COLOR_ORDER LED_ORDER = WS2812::COLOR_ORDER::GRB;
// Defaults... floats are between 0 and 1.0f
const LEDControl::state_t DEFAULT_STATE = {
// Hue the LEDs will start at. 1.0f = 360 degrees
.hue = 0.56f,
// Angle (in degrees) from the hue, the LEDs will end at (1.0f = 360 degrees)
.angle = 0.68f,
// Speed the LEDs will start cycling at
.speed = 0.04f,
// Brightness to set the LEDs to. 1.0f = 100%
.brightness = 0.5f,
// Default effect we start at
.effect = LEDControl::EFFECT_MODE::HUE_CYCLE,
// Default encoder mode we start at
.mode = LEDControl::ENCODER_MODE::OFF,
// Leave these as-is unless you want funky starting values
.on = true,
.stopped = false,
.absent = false,
};
// More configuration
const float_t MIN_BRIGHTNESS = 0.1f; // below this there's no meaningful output
const float_t MAX_BRIGHTNESS = 1.0f;
const float_t MIN_SPEED = 0.0f;
const float_t MAX_SPEED = 0.18f; // let's be safe and not trigger anyone
// How many times the LEDs will be updated per second
const uint UPDATES = 60;
// Default brightness for the encoder LED
const float_t ENC_DEFAULT_BRIGHTNESS = 0.5f;
// See connections section in README
const uint LED_DATA_PIN = 28;
const uint BUTTON_B_PIN = 27;
const uint BUTTON_C_PIN = 26;
//const bool PRESENCE_ENABLED = false;
const bool PRESENCE_ENABLED = true;
const bool PRESENCE_PIN_ENABLED = true;
const uint PRESENCE_PIN = 22;
const bool PRESENCE_PIN_ACTIVE_LOW = false;
#define PRESENCE_UART uart1
const uint PRESENCE_UART_RX_PIN = 4; // set these pins to 0 to disable UART
const uint PRESENCE_UART_TX_PIN = 5;
const float PRESENCE_RANGE_METERS = 2.0f; // only available if uart is enabled
const uint16_t PRESENCE_CHECK_INTERVAL = 1000; // ms
const uint16_t FADE_IN_DURATION = 1000; // ms
const uint16_t FADE_OUT_DURATION = 2000; // ms
const uint16_t ENCODER_INACTIVITY_TIMEOUT = 10000; // ms. after 10 seconds, encoder will switch to off mode and encoder LED will turn off
const uint16_t GLOBAL_INACTIVITY_TIMEOUT_SECS = 0; // ms. after 1 hour (3600) seconds of inactivity, LEDs will turn off. Set to 0 to disable.
//const uint16_t GLOBAL_INACTIVITY_TIMEOUT_SECS = 3600; // ms. after 1 hour (3600) seconds of inactivity, LEDs will turn off. Set to 0 to disable.
#define ROT_A 16 // rotary A (leftmost pin in rotary)
#define ROT_B 17 // rotary B (rightmost pin in rotary)
#define ROT_LEDR 18 // red LED
#define ROT_LEDG 19 // green LED
#define ROT_SW 20 // rotary pushbutton
#define ROT_LEDB 21 // blue LED
#ifndef RASPBERRYPI_PICO_W
#define LED_PAUSED_PIN PICO_DEFAULT_LED_PIN
#define BOARD_LED_PIN PICO_DEFAULT_LED_PIN
#endif
// A region 1.5MB from the start of flash.
#define FLASH_TARGET_OFFSET (1536 * 1024)
#endif //CONFIG_H