mirror of
https://github.com/manuelbl/ttn-esp32.git
synced 2025-08-17 12:10:34 +02:00
Configue sub-band
This commit is contained in:
11
src/ttn.c
11
src/ttn.c
@ -60,6 +60,7 @@ static ttn_message_cb message_callback;
|
||||
static ttn_waiting_reason_t waiting_reason = TTN_WAITING_NONE;
|
||||
static ttn_rf_settings_t last_rf_settings[4];
|
||||
static ttn_rx_tx_window_t current_rx_tx_window;
|
||||
static int subband = 1;
|
||||
|
||||
static bool join_core(void);
|
||||
static void event_callback(void* user_data, ev_t event);
|
||||
@ -99,6 +100,11 @@ void ttn_configure_pins(spi_host_device_t spi_host, uint8_t nss, uint8_t rxtx, u
|
||||
hal_esp32_start_lmic_task();
|
||||
}
|
||||
|
||||
void ttn_set_subband(int band)
|
||||
{
|
||||
subband = band;
|
||||
}
|
||||
|
||||
void ttn_reset(void)
|
||||
{
|
||||
hal_esp32_enter_critical_section();
|
||||
@ -203,6 +209,11 @@ bool join_core()
|
||||
hal_esp32_enter_critical_section();
|
||||
xQueueReset(lmic_event_queue);
|
||||
waiting_reason = TTN_WAITING_FOR_JOIN;
|
||||
|
||||
#if defined(CFG_us915) || defined(CFG_au915)
|
||||
LMIC_selectSubBand(subband - 1);
|
||||
#endif
|
||||
|
||||
LMIC_startJoining();
|
||||
hal_esp32_wake_up();
|
||||
hal_esp32_leave_critical_section();
|
||||
|
Reference in New Issue
Block a user