Don't drop second package if it will be split
[ExpressLRS.git] / src / include / targets.h
blobf52a27327c5d27ff799935c37b1d9014914e6d74
1 #pragma once
2 #if !defined TARGET_NATIVE
3 #include <Arduino.h>
4 #endif
6 #define UNDEF_PIN (-1)
8 /// General Features ///
9 #define LED_MAX_BRIGHTNESS 50 //0..255 for max led brightness
11 /////////////////////////
13 #define WORD_ALIGNED_ATTR __attribute__((aligned(4)))
15 #ifdef PLATFORM_STM32
16 /* ICACHE_RAM_ATTR1 is always linked into RAM */
17 #define ICACHE_RAM_ATTR1 __section(".ram_code")
18 /* ICACHE_RAM_ATTR2 is linked into RAM only if enough space */
19 #if RAM_CODE_LIMITED
20 #define ICACHE_RAM_ATTR2
21 #else
22 #define ICACHE_RAM_ATTR2 __section(".ram_code")
23 #endif
24 #define ICACHE_RAM_ATTR //nothing//
25 #else
26 #undef ICACHE_RAM_ATTR //fix to allow both esp32 and esp8266 to use ICACHE_RAM_ATTR for mapping to IRAM
27 #define ICACHE_RAM_ATTR IRAM_ATTR
28 #endif
30 #if defined(TARGET_NATIVE)
31 #define IRAM_ATTR
32 #include "native.h"
33 #endif
35 #if defined(PLATFORM_STM32)
36 #ifdef GPIO_PIN_LED_WS2812
37 #ifndef GPIO_PIN_LED_WS2812_FAST
38 #error "WS2812 support requires _FAST pin!"
39 #endif
40 #else
41 #define GPIO_PIN_LED_WS2812 UNDEF_PIN
42 #define GPIO_PIN_LED_WS2812_FAST UNDEF_PIN
43 #endif
44 #endif
46 /* Set red led to default */
47 #ifndef GPIO_PIN_LED
48 #ifdef GPIO_PIN_LED_RED
49 #define GPIO_PIN_LED GPIO_PIN_LED_RED
50 #endif /* GPIO_PIN_LED_RED */
51 #endif /* GPIO_PIN_LED */
53 #ifndef GPIO_PIN_BUFFER_OE
54 #define GPIO_PIN_BUFFER_OE UNDEF_PIN
55 #endif
56 #ifndef GPIO_PIN_RST
57 #define GPIO_PIN_RST UNDEF_PIN
58 #endif
59 #ifndef GPIO_PIN_BUSY
60 #define GPIO_PIN_BUSY UNDEF_PIN
61 #endif
62 #ifndef GPIO_PIN_DIO0
63 #define GPIO_PIN_DIO0 UNDEF_PIN
64 #endif
65 #ifndef GPIO_PIN_DIO1
66 #define GPIO_PIN_DIO1 UNDEF_PIN
67 #endif
68 #ifndef GPIO_PIN_DIO2
69 #define GPIO_PIN_DIO2 UNDEF_PIN
70 #endif
71 #ifndef GPIO_PIN_PA_ENABLE
72 #define GPIO_PIN_PA_ENABLE UNDEF_PIN
73 #endif
74 #ifndef GPIO_BUTTON_INVERTED
75 #define GPIO_BUTTON_INVERTED 0
76 #endif
77 #ifndef GPIO_LED_RED_INVERTED
78 #define GPIO_LED_RED_INVERTED 0
79 #endif
80 #ifndef GPIO_LED_GREEN_INVERTED
81 #define GPIO_LED_GREEN_INVERTED 0
82 #endif
83 #ifndef GPIO_LED_BLUE_INVERTED
84 #define GPIO_LED_BLUE_INVERTED 0
85 #endif
87 #if !defined(BACKPACK_LOGGING_BAUD)
88 #define BACKPACK_LOGGING_BAUD 460800
89 #endif
91 #if defined(Regulatory_Domain_ISM_2400)
92 // ISM 2400 band is use => undefine other requlatory domain defines
93 #undef Regulatory_Domain_AU_915
94 #undef Regulatory_Domain_EU_868
95 #undef Regulatory_Domain_IN_866
96 #undef Regulatory_Domain_FCC_915
97 #undef Regulatory_Domain_AU_433
98 #undef Regulatory_Domain_EU_433
100 #elif !(defined(Regulatory_Domain_AU_915) || defined(Regulatory_Domain_FCC_915) || \
101 defined(Regulatory_Domain_EU_868) || defined(Regulatory_Domain_IN_866) || \
102 defined(Regulatory_Domain_AU_433) || defined(Regulatory_Domain_EU_433) || \
103 defined(UNIT_TEST))
104 #error "Regulatory_Domain is not defined for 900MHz devices. Check user_defines.txt!"
105 #endif