103 lines
2.8 KiB
C
103 lines
2.8 KiB
C
|
|
#define relay_1 12
|
|
#define relay_2 13
|
|
|
|
#define LIGHT_SENSOR_PIN 36
|
|
|
|
//System btns color
|
|
#define BLEColorNotConnected CRGB(0,0,255)
|
|
#define BLEColorConnected CRGB(50,50,255)
|
|
#define NRFColorNotConnected CRGB(0,255,0)
|
|
#define NRFColorConnected CRGB(50,255,50)
|
|
#define DebugColor CRGB(255,255,0)
|
|
|
|
//input numbers
|
|
#define NUM_BTNS 20
|
|
#define LED_DATA_PIN 15
|
|
#define NUM_ANALOG 8
|
|
|
|
#define NUM_LEDS NUM_BTNS+2
|
|
|
|
//button timing
|
|
|
|
#define short_click 500
|
|
|
|
#define long_click 1000
|
|
|
|
#define double_click_brake 250
|
|
|
|
//mode
|
|
#define mode_radio 0
|
|
#define mode_bluetooth 1
|
|
#define mode_debug 2
|
|
|
|
//rpi
|
|
#define rpi_off 0
|
|
#define rpi_starting 1
|
|
#define rpi_on 2
|
|
#define rpi_stoping 3
|
|
#define rpi_unknown 4 //shut be on
|
|
|
|
#define rpi_max_boot_time 30000
|
|
#define rpi_stop_time 30000
|
|
#define rpi_max_black_time 10000
|
|
|
|
//Seriel commands
|
|
#define Serial_end 0xff
|
|
//rpi --> esp32 (back is awnser)
|
|
#define cmd_check 0b00000001
|
|
|
|
#define cmd_setMode 0b00000010
|
|
// > uint8_t:mode
|
|
// < bool:ok
|
|
#define cmd_getStatus 0b00000011
|
|
// < uint8_t:mode, bool:connected
|
|
|
|
//esp32 --> rpi (back is awnser)
|
|
|
|
#define cmd_empty 0b00000000
|
|
|
|
//radio
|
|
//types
|
|
|
|
|
|
|
|
//hid (input)
|
|
/*
|
|
[byte] mode|submode, [byte] value
|
|
|
|
//color if btn(default)
|
|
mode: #00, value:? unsigned 1
|
|
|
|
mode: #1t, value: x normal btn 2 (off/on)
|
|
mode: #2t, value: x seemingly switch 3 (off/down/on)
|
|
mode: #3t, value: x switch 3 (off/down/on)
|
|
//t
|
|
0: x = 0-255 scancode
|
|
1: x = 1-16 MediaKey
|
|
2: x = 1-13 Gamepadbtns
|
|
3: x = 0-3 HAT
|
|
4: x = 0-4 Mouse
|
|
|
|
mode: #4j, value: value to set or analoge input setAnaloge 2 (off/on)
|
|
mode: #5j, value: amount or multiplay of joystick percentage incrementalchange (down) 2 (off/on)
|
|
mode: #6j, value: amount or multiplay of joystick percentage incrementalchange (up) 2 (off/on)
|
|
//j ble
|
|
0-7 analog inputs (lx, ly, rx, ry, lt, rt, lr, rr)
|
|
8-9 mouse directions (x,y)
|
|
a-b mouse wheel (v,h)
|
|
//j nrf
|
|
0-f analoge value
|
|
|
|
|
|
function: [{ mode|submode, value }, ...] for every
|
|
// 8x analoge (ilx, ily, irx, iry, ilt, irt, ilr, irr)
|
|
8x hat (lt, lr, ld, ll, rt, rr, rb, rl)
|
|
10x btns (from left to right)
|
|
|
|
theme: [{color1 (off), color2 (on), color2 (down)}, ...]
|
|
// 8x hat (lt, lr, ld, ll, rt, rr, rb, rl)
|
|
10x btns (from left to right)
|
|
|
|
|
|
*/
|