mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-06 09:57:52 +00:00
Support T3S3 LR1121 variant
This commit is contained in:
@@ -14,6 +14,7 @@ template class SX126xInterface<LLCC68>;
|
||||
template class SX128xInterface<SX1280>;
|
||||
template class LR11x0Interface<LR1110>;
|
||||
template class LR11x0Interface<LR1120>;
|
||||
template class LR11x0Interface<LR1121>;
|
||||
#ifdef ARCH_STM32WL
|
||||
template class SX126xInterface<STM32WLx>;
|
||||
#endif
|
||||
|
||||
@@ -6,4 +6,9 @@ LR1120Interface::LR1120Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, R
|
||||
RADIOLIB_PIN_TYPE busy)
|
||||
: LR11x0Interface(hal, cs, irq, rst, busy)
|
||||
{
|
||||
}
|
||||
|
||||
bool LR1120Interface::wideLora()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -10,4 +10,5 @@ class LR1120Interface : public LR11x0Interface<LR1120>
|
||||
public:
|
||||
LR1120Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||
RADIOLIB_PIN_TYPE busy);
|
||||
bool wideLora() override;
|
||||
};
|
||||
14
src/mesh/LR1121Interface.cpp
Normal file
14
src/mesh/LR1121Interface.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "LR1121Interface.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
|
||||
LR1121Interface::LR1121Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||
RADIOLIB_PIN_TYPE busy)
|
||||
: LR11x0Interface(hal, cs, irq, rst, busy)
|
||||
{
|
||||
}
|
||||
|
||||
bool LR1121Interface::wideLora()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
14
src/mesh/LR1121Interface.h
Normal file
14
src/mesh/LR1121Interface.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "LR11x0Interface.h"
|
||||
|
||||
/**
|
||||
* Our adapter for LR1121 wideband radios
|
||||
*/
|
||||
class LR1121Interface : public LR11x0Interface<LR1121>
|
||||
{
|
||||
public:
|
||||
LR1121Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||
RADIOLIB_PIN_TYPE busy);
|
||||
bool wideLora() override;
|
||||
};
|
||||
@@ -10,8 +10,14 @@
|
||||
|
||||
// Particular boards might define a different max power based on what their hardware can do, default to max power output if not
|
||||
// specified (may be dangerous if using external PA and LR11x0 power config forgotten)
|
||||
#ifndef LR11X0_MAX_POWER
|
||||
#define LR11X0_MAX_POWER 22
|
||||
#ifndef LR1110_MAX_POWER
|
||||
#define LR1110_MAX_POWER 22
|
||||
#endif
|
||||
|
||||
// the 2.4G part maxes at 13dBm
|
||||
|
||||
#ifndef LR1120_MAX_POWER
|
||||
#define LR1120_MAX_POWER 13
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
@@ -47,8 +53,12 @@ template <typename T> bool LR11x0Interface<T>::init()
|
||||
|
||||
RadioLibInterface::init();
|
||||
|
||||
if (power > LR11X0_MAX_POWER) // Clamp power to maximum defined level
|
||||
power = LR11X0_MAX_POWER;
|
||||
if (power > LR1110_MAX_POWER) // Clamp power to maximum defined level
|
||||
power = LR1110_MAX_POWER;
|
||||
|
||||
if ((power > LR1120_MAX_POWER) &&
|
||||
(config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) // clamp again if wide freq range
|
||||
power = LR1120_MAX_POWER;
|
||||
|
||||
limitPower();
|
||||
|
||||
@@ -65,6 +75,18 @@ template <typename T> bool LR11x0Interface<T>::init()
|
||||
{LR11x0::MODE_WIFI, {LOW, LOW, LOW, LOW}}, END_OF_MODE_TABLE,
|
||||
};
|
||||
|
||||
#elif defined(TLORA_T3S3_V1)
|
||||
static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC,
|
||||
RADIOLIB_NC};
|
||||
|
||||
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||
// mode DIO5 DIO6
|
||||
{LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}},
|
||||
{LR11x0::MODE_TX, {LOW, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}},
|
||||
{LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}},
|
||||
{LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE,
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// set RF switch configuration for Wio WM1110
|
||||
@@ -174,8 +196,10 @@ template <typename T> bool LR11x0Interface<T>::reconfigure()
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
if (power > LR11X0_MAX_POWER) // This chip has lower power limits than some
|
||||
power = LR11X0_MAX_POWER;
|
||||
if (power > LR1110_MAX_POWER) // This chip has lower power limits than some
|
||||
power = LR1110_MAX_POWER;
|
||||
if ((power > LR1120_MAX_POWER) && (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) // 2.4G power limit
|
||||
power = LR1120_MAX_POWER;
|
||||
|
||||
err = lora.setOutputPower(power);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
Reference in New Issue
Block a user