Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename and use define for radio chip #1425

Merged
merged 4 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#ifndef UNIT_TEST
#include "targets.h"

#if defined(Regulatory_Domain_AU_915) || defined(Regulatory_Domain_EU_868) || defined(Regulatory_Domain_IN_866) || defined(Regulatory_Domain_FCC_915) || defined(Regulatory_Domain_AU_433) || defined(Regulatory_Domain_EU_433)
#if defined(RADIO_SX127X)
#include "SX127xDriver.h"
#elif defined(Regulatory_Domain_ISM_2400)
#elif defined(RADIO_SX1280)
#include "SX1280Driver.h"
#else
#error "Radio configuration is not valid!"
Expand Down Expand Up @@ -122,15 +122,14 @@ typedef struct expresslrs_mod_settings_s
} expresslrs_mod_settings_t;

#ifndef UNIT_TEST
#if defined(Regulatory_Domain_AU_915) || defined(Regulatory_Domain_EU_868) || defined(Regulatory_Domain_IN_866) \
|| defined(Regulatory_Domain_FCC_915) || defined(Regulatory_Domain_AU_433) || defined(Regulatory_Domain_EU_433)
#if defined(RADIO_SX127X)
#define RATE_MAX 4
#define RATE_DEFAULT 0
#define RATE_BINDING 2 // 50Hz bind mode

extern SX127xDriver Radio;

#elif defined(Regulatory_Domain_ISM_2400)
#elif defined(RADIO_SX1280)
#define RATE_MAX 4
#define RATE_DEFAULT 0
#define RATE_BINDING 2 // 50Hz bind mode
Expand Down
2 changes: 2 additions & 0 deletions src/include/native.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <math.h>
#include <sys/time.h>

#define RADIO_SX1280 1

typedef uint8_t byte;

#define HEX 16
Expand Down
5 changes: 3 additions & 2 deletions src/include/target/AXIS_THOR_2400_RX.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#define DEVICE_NAME "AXIS THOR 2400RX"

#define RADIO_SX1280

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_BUSY 5
Expand All @@ -13,5 +16,3 @@
#endif

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/AXIS_THOR_2400_TX.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define DEVICE_NAME "AXIS THOR 2400TX"

#define RADIO_SX1280
#define USE_TX_BACKPACK

#define HAS_TFT_SCREEN
Expand Down Expand Up @@ -52,5 +53,3 @@
#define MaxPower PWR_1000mW
#define DefaultPower PWR_10mW
#define POWER_OUTPUT_VALUES {-16,-12,-9,-6,-2,0,7}

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/BETAFPV_2400_RX.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DEVICE_NAME "BETAFPV 2G4RX"
#endif

#define RADIO_SX1280
#define USE_SX1280_DCDC

// GPIO pin definitions
Expand All @@ -20,5 +21,3 @@

// Output Power
#define POWER_OUTPUT_FIXED 1 // -10=10mW, -6=25mW, -3=50mW, 1=100mW

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/BETAFPV_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// There is some special handling for this target
#define TARGET_TX_BETAFPV_2400_V1
#define RADIO_SX1280

// GPIO pin definitions
#define GPIO_PIN_NSS 5
Expand All @@ -26,5 +27,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_500mW
#define POWER_OUTPUT_VALUES {-18,-15,-13,-9,-4,3}

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/BETAFPV_2400_TX_MICRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

// Any device features
#define USE_TX_BACKPACK
#define RADIO_SX1280
#define USE_OLED_I2C
#define OLED_REVERSED
#define HAS_FIVE_WAY_BUTTON
Expand Down Expand Up @@ -50,5 +51,3 @@

/* Joystick values {UP, DOWN, LEFT, RIGHT, ENTER, IDLE}*/
#define JOY_ADC_VALUES {2839, 2191, 1616, 3511, 0, 4095}

#define Regulatory_Domain_ISM_2400 1
1 change: 1 addition & 0 deletions src/include/target/BETAFPV_900_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// There is some special handling for this target
#define TARGET_TX_BETAFPV_900_V1
#define RADIO_SX127X
#define USE_SX1276_RFO_HF

// GPIO pin definitions
Expand Down
1 change: 1 addition & 0 deletions src/include/target/BETAFPV_900_TX_MICRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#endif

// Any device features
#define RADIO_SX127X
#define USE_SX1276_RFO_HF
#define USE_OLED_I2C
#define OLED_REVERSED
Expand Down
4 changes: 2 additions & 2 deletions src/include/target/DIY_2400_RX_ESP8285_SX1280.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define DEVICE_NAME "ELRS 2400RX"
#endif

#define RADIO_SX1280

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_BUSY 5
Expand All @@ -16,5 +18,3 @@
#endif

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/DIY_2400_RX_PWMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DEVICE_NAME "DIY2400 PWMP"
#endif

#define RADIO_SX1280
#define CRSF_RCVR_NO_SERIAL

// GPIO pin definitions
Expand All @@ -21,5 +22,3 @@
#else
#define GPIO_PIN_PWM_OUTPUTS {0, 1, 3, 9, 10}
#endif

#define Regulatory_Domain_ISM_2400 1
4 changes: 2 additions & 2 deletions src/include/target/DIY_2400_RX_STM32_CCG_Nano_v0_5.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define DEVICE_NAME "ELRS 2400RX"
#endif

#define RADIO_SX1280

// GPIO pin definitions
#define GPIO_PIN_NSS PA4
#define GPIO_PIN_MOSI PA7
Expand All @@ -18,5 +20,3 @@
#define GPIO_PIN_LED_RED PB5

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
5 changes: 2 additions & 3 deletions src/include/target/DIY_2400_TX_DUPLETX_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
#endif

// Any device features
#define USE_TX_BACKPACK
#define RADIO_SX1280
#define USE_SX1280_DCDC
#define USE_TX_BACKPACK
#define USE_SKY85321
#define SKY85321_PDET_SLOPE 0.035
#define SKY85321_PDET_INTERCEPT 2.4
Expand Down Expand Up @@ -35,5 +36,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-17,-13,-9,-6,-2}

#define Regulatory_Domain_ISM_2400 1
5 changes: 2 additions & 3 deletions src/include/target/DIY_2400_TX_ESP32_SX1280_E28.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
#endif

// Any device features
#define RADIO_SX1280
#define USE_SX1280_DCDC
#if !defined(USE_OLED_I2C)
#define USE_OLED_SPI
#endif
#define USE_SX1280_DCDC

// GPIO pin definitions
#define GPIO_PIN_NSS 5
Expand Down Expand Up @@ -38,5 +39,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-15,-11,-8,-5,-1}

#define Regulatory_Domain_ISM_2400 1
4 changes: 2 additions & 2 deletions src/include/target/DIY_2400_TX_ESP32_SX1280_Mini.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define DEVICE_NAME "DIY2400 Mini"
#endif

#define RADIO_SX1280

// GPIO pin definitions
#define GPIO_PIN_NSS 5
#define GPIO_PIN_BUSY 21
Expand All @@ -17,5 +19,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_25mW
#define POWER_OUTPUT_VALUES {8, 13}

#define Regulatory_Domain_ISM_2400 1
4 changes: 2 additions & 2 deletions src/include/target/DIY_2400_TX_ESP8285_SX1280.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define DEVICE_NAME "DIY2400 ESP8266"
#endif

#define RADIO_SX1280

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_BUSY 5
Expand All @@ -19,5 +21,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_10mW
#define POWER_OUTPUT_VALUES {13}

#define Regulatory_Domain_ISM_2400 1
2 changes: 2 additions & 0 deletions src/include/target/DIY_900_RX_ESP8285_SX127x.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define DEVICE_NAME "ELRS 900RX"
#endif

#define RADIO_SX127X

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_DIO0 4
Expand Down
2 changes: 2 additions & 0 deletions src/include/target/DIY_900_RX_HUZZAH_RFM95W.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define DEVICE_NAME "ELRS 900RX"
#endif

#define RADIO_SX127X

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_DIO0 5
Expand Down
1 change: 1 addition & 0 deletions src/include/target/DIY_900_RX_PWMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DEVICE_NAME "DIY900 PWMP"
#endif

#define RADIO_SX127X
#define CRSF_RCVR_NO_SERIAL

// GPIO pin definitions
Expand Down
2 changes: 2 additions & 0 deletions src/include/target/DIY_900_TX_ESP32_SX127x_E19.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#define DEVICE_NAME "DIY900 E19"
#endif

#define RADIO_SX127X

// GPIO pin definitions
#define GPIO_PIN_NSS 5
#define GPIO_PIN_DIO0 26
Expand Down
2 changes: 2 additions & 0 deletions src/include/target/DIY_900_TX_ESP32_SX127x_RFM95.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#define DEVICE_NAME "DIY900 RFM95"
#endif

#define RADIO_SX127X

// GPIO pin definitions
#define GPIO_PIN_NSS 5
#define GPIO_PIN_DIO0 26
Expand Down
1 change: 1 addition & 0 deletions src/include/target/DIY_900_TX_TTGO_V1_SX127x.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#endif

// Any device features
#define RADIO_SX127X
#define USE_OLED_I2C

// GPIO pin definitions
Expand Down
1 change: 1 addition & 0 deletions src/include/target/DIY_900_TX_TTGO_V2_SX127x.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#endif

// Any device features
#define RADIO_SX127X
#define USE_OLED_I2C

// GPIO pin definitions
Expand Down
3 changes: 1 addition & 2 deletions src/include/target/FM30_RX_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#endif
#endif

#define RADIO_SX1280
#define USE_SX1280_DCDC

// GPIO pin definitions
Expand Down Expand Up @@ -53,5 +54,3 @@
#define POWER_OUTPUT_FIXED -1 // 100mW (uses values as above)
#endif
#endif

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/FM30_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// There is some special handling for this target
#define TARGET_TX_FM30
#define RADIO_SX1280
#define USE_SX1280_DCDC

// GPIO pin definitions
Expand Down Expand Up @@ -45,5 +46,3 @@
#define HighPower PWR_100mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-15,-11,-7,-1,6}

#define Regulatory_Domain_ISM_2400 1
2 changes: 2 additions & 0 deletions src/include/target/Frsky_RX_R9M.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Credit to Jacob Walser (jaxxzer) for the pinout!!!
#define TARGET_EEPROM_ADDR 0x50
#endif

#define RADIO_SX127X

#define GPIO_PIN_NSS PB12 //confirmed on SLIMPLUS, R900MINI
#define GPIO_PIN_DIO0 PA15 //confirmed on SLIMPLUS, R900MINI
#define GPIO_PIN_DIO1 PA1 // NOT CORRECT!!! PIN STILL NEEDS TO BE FOUND BUT IS CURRENTLY UNUSED
Expand Down
1 change: 1 addition & 0 deletions src/include/target/Frsky_TX_R9M.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define DEVICE_NAME "FrSky R9M"
#endif

#define RADIO_SX127X
#define TARGET_USE_EEPROM 1
#define TARGET_EEPROM_ADDR 0x51
#define TARGET_EEPROM_400K
Expand Down
1 change: 1 addition & 0 deletions src/include/target/Frsky_TX_R9M_LITE.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DEVICE_NAME "FrSky R9M Lite"
#endif

#define RADIO_SX127X
#define TARGET_USE_EEPROM 1
#define TARGET_EEPROM_ADDR 0x51

Expand Down
1 change: 1 addition & 0 deletions src/include/target/Frsky_TX_R9M_LITE_PRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DEVICE_NAME "FrSky R9M Lt Pro"
#endif

#define RADIO_SX127X
#define TARGET_USE_EEPROM 1
#define TARGET_EEPROM_ADDR 0x51

Expand Down
3 changes: 1 addition & 2 deletions src/include/target/GHOST_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#endif
// There is some special handling for this target
#define TARGET_TX_GHOST
#define RADIO_SX1280

// Any device features
#if !defined(USE_OLED_SPI_SMALL)
Expand Down Expand Up @@ -48,5 +49,3 @@
/* Joystick values {UP, DOWN, LEFT, RIGHT, ENTER, IDLE}*/
#define JOY_ADC_VALUES {459, 509, 326, 182, 91, 1021}
#endif

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/GHOST_ATTO_2400_RX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#endif
// There is some special handling for this target
#define TARGET_RX_GHOST_ATTO_V1
#define RADIO_SX1280

// GPIO pin definitions
#define GPIO_PIN_NSS PA15
Expand All @@ -22,5 +23,3 @@
//#define GPIO_PIN_BUTTON PA12

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/HGLRC_Hermes_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#endif

// Any device features
#define RADIO_SX1280
#define USE_SX1280_DCDC

// GPIO pin definitions
Expand All @@ -22,5 +23,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-18,-15,-11,-8,-4}

#define Regulatory_Domain_ISM_2400 1