This repository has been archived by the owner on Aug 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefinitions.h
76 lines (62 loc) · 3.69 KB
/
Definitions.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
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
// DEFAULT DEFINES
#define SCREEN_WIDTH 128 //OLED display width, in pixels
#define SCREEN_HEIGHT 32 //OLED display height, in pixels
#define MPU_UPSIDEDOWN 1 //Enable if MPU chip faces downward (default is facing up)
#define PWM_FREQ 250 //ESC Control signal, Default: 50Hz
#define PWM_MIN_DUTY 1000 //ESC Minimum Pulse Width (us)
#define PWM_MAX_DUTY 2000 //ESC Maximum Pulse Width (us)
#define ESC_1 26 //PWM0A Pin
#define ESC_2 25 //PWM0B Pin
#define ESC_3 33 //PWM1A Pin
#define ESC_4 32 //PWM1B Pin
#define RF24_CE 2 //nRF24 CE Pin
#define RF24_CSN 0 //nRF24 CSN Pin
#define RF24_FREQ 1000000 //nRF24 SPI Speed
#define CFG_MAGIC 0xDEADBEEF //Config Struct Header
#define CFG_MAGIC2 0xFEEBDAED //Config Struct Footer
#define TMTY_HEADER 0x533D //Telemetry Frame Header
#define MSG_START 0xB1 //Message Start Flag
#define DATA_START 0xD2 //Data Start Flag
#define MSG_END 0xB2 //Message End Flag
#define DATA_END 0xD1 //Data End Flag
#define EEPROM_START_ADDR 0 //EEPROM Data start address
#define EEPROM_SIZE 512 //EEPROM Allocated Size in Bytes (512 Max)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// ------------------- SYNC ANY CHANGES WITH ESP_CONFIGURATOR APP CODE ---------------------
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//Serial Commands
#define CFG_MODE 50 //Enable configurator
#define READ_CFG 51 //Read configuration from EEPROM
#define WRITE_CFG 52 //Write configuration to EEPROM
#define ARM_TETHERED 53 //Arm the quad while connected for debugging/testing
#define DISARM 54 //Disarm
#define RESTART_FC 55 //Reboot ESP32
#define TELEMETRY_START 56 //Request serial telemetry
#define TELEMETRY_STOP 57 //Stop serial telemetry
//ESP Callbacks
#define HANDSHAKE 58 //Serial connected
#define SERIALPOLL 48 //ESP32 Polling for serial connection
#define CFG_DATA_FLAG 59 //Indicate data is outbound
#define TMTY_DATA_FLAG 60 //Indicate telemetry frame is outbound
#define W_EEPROM_OK 61 //New configuration flashed succesfully
#define W_EEPROM_ERR 62 //New configuration flash failed
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//PWM RC Detection RMT Perhiperal Parameters
// We will use a fixed array of 6 for axis data for now
// TODO: Add support for arbitrary number of axes and digital inputs
#define RMT_TICK_PER_US 1 //determines how many clock cycles one "tick" is, [1..255] source is generally 80MHz APB clk
#define RMT_RX_MAX_US 3500 //time before receiver goes idle (longer pulses will be ignored)
#define PWM_CHANNELS_NUM 6 //Receiver PWM Channel Number
#define PWM_CHANNELS 1,2,3,4,5,6 // Change the channels according to the number of channels
#define RECEIVER_GPIO 35,34,39,36,27,14
#define PWM_CENTER 1500 //Center of receiver PWM pulse
#define RX_DEADZONE 2 //Deadzone for receiver PWM pulse
#define RMT_RX_CLK_DIV (80000000/RMT_TICK_PER_US/1000000) //Divide 80Mhz APB clk by 1Mhz to get the clock for the receiver
//ch1 yaw
//ch2 pitch
//ch3 throttle
//ch4 roll
//ch5 arm switch 3 way
#endif // DEFINITIONS_H