Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
- MeshCore-based Simple Sensor firmware - Heltec T114 without display - BME280 sensor support (temp/humidity/pressure) - Radio: 868.856018 MHz, SF7, BW62.5 kHz, CR4/7 - 2-byte path hash - PlatformIO project
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
#include "LoRaFEMControl.h"
|
|
#include <driver/rtc_io.h>
|
|
#include <esp_sleep.h>
|
|
#include <Arduino.h>
|
|
|
|
void LoRaFEMControl::init(void)
|
|
{
|
|
pinMode(P_LORA_PA_POWER, OUTPUT);
|
|
digitalWrite(P_LORA_PA_POWER, HIGH);
|
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_POWER);
|
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_KCT8103L_PA_CSD);
|
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_KCT8103L_PA_CTX);
|
|
delay(1);
|
|
pinMode(P_LORA_KCT8103L_PA_CSD, OUTPUT);
|
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
|
pinMode(P_LORA_KCT8103L_PA_CTX, OUTPUT);
|
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
|
setLnaCanControl(true);
|
|
}
|
|
|
|
void LoRaFEMControl::setSleepModeEnable(void)
|
|
{
|
|
// shutdown the PA
|
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, LOW);
|
|
}
|
|
|
|
void LoRaFEMControl::setTxModeEnable(void)
|
|
{
|
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
|
}
|
|
|
|
void LoRaFEMControl::setRxModeEnable(void)
|
|
{
|
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
|
if (lna_enabled) {
|
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, LOW);
|
|
} else {
|
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
|
}
|
|
}
|
|
|
|
void LoRaFEMControl::setRxModeEnableWhenMCUSleep(void)
|
|
{
|
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
|
rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CSD);
|
|
if (lna_enabled) {
|
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, LOW);
|
|
} else {
|
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
|
}
|
|
rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CTX);
|
|
}
|
|
|
|
void LoRaFEMControl::setLNAEnable(bool enabled)
|
|
{
|
|
lna_enabled = enabled;
|
|
}
|