mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-15 03:49:55 +00:00
bump zephyr
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* RAK4631 overlay for SoftDevice + UF2 bootloader.
|
||||
* App at 0x26000, storage at 0xD4000, bootloader at 0xF4000.
|
||||
* Uses SoftDevice s140 v6.1.1 (ends at 0x26000).
|
||||
* Console: USB CDC ACM.
|
||||
* Console: USB CDC ACM (upstream's board_cdc_acm_uart).
|
||||
* Battery: AIN3 = P0.05, voltage divider per RAK4631 schematic.
|
||||
*
|
||||
* QSPI Flash: Optional external flash on WisBlock Base boards.
|
||||
@@ -38,11 +38,26 @@
|
||||
};
|
||||
chosen {
|
||||
zephyr,code-partition = &code_partition;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zephyr,shell-uart = &cdc_acm_uart;
|
||||
zephyr,display = &ssd1306;
|
||||
};
|
||||
|
||||
/* Both LEDs are active-high. Upstream's board file stopped declaring
|
||||
* them at Zephyr 4085ca50ab6 (it now describes the bare core module and
|
||||
* leaves LEDs to base-board shields), so they live here. */
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
blue_led: led_2 {
|
||||
gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
|
||||
label = "Blue LED";
|
||||
};
|
||||
|
||||
green_led: led_1 {
|
||||
gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
|
||||
label = "Green LED";
|
||||
};
|
||||
};
|
||||
|
||||
/* User button: P0.09 (NFC1). P0.00/P0.01 are 32k crystal — do not use for GPIO. */
|
||||
buttons: buttons {
|
||||
compatible = "gpio-keys";
|
||||
@@ -93,10 +108,24 @@
|
||||
};
|
||||
};
|
||||
|
||||
&zephyr_udc0 {
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
/* Since Zephyr 4085ca50ab6 upstream describes the bare core module with every
|
||||
* WisBlock peripheral enabled for shields to claim. We use none of the PWM
|
||||
* channels or the 802.15.4 radio; turn them back off so the build carries the
|
||||
* same devices it did before that rework. */
|
||||
&pwm0 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&pwm1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&pwm2 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&ieee802154 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&lora {
|
||||
@@ -141,15 +170,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
/* LEDs are active-high on this board (stock RAK4631 DTS used active-low). */
|
||||
&green_led {
|
||||
gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
&blue_led {
|
||||
gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
/*
|
||||
* GPS on UART1 - RAK1910 (u-blox MAX-7Q) at 9600 baud, Slot A.
|
||||
*
|
||||
@@ -161,6 +181,7 @@
|
||||
* upstream, whereas uart0 is the legacy nrf-uart.
|
||||
*/
|
||||
&uart1 {
|
||||
status = "okay";
|
||||
current-speed = <9600>;
|
||||
gnss: gnss-nmea-generic {
|
||||
compatible = "gnss-nmea-generic";
|
||||
@@ -176,6 +197,8 @@
|
||||
|
||||
/* I2C0: optional SSD1306 + sensors */
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
|
||||
ssd1306: ssd1306@3c {
|
||||
compatible = "solomon,ssd1306";
|
||||
reg = <0x3c>;
|
||||
|
||||
@@ -534,6 +534,16 @@ int mc_display_init(void)
|
||||
* SSD1306 OLED reports MONO01 by default, which CFB now handles
|
||||
* correctly (white pixels on black background) without manual invert. */
|
||||
|
||||
/* E-paper is the exception: the page is white and the ink is black.
|
||||
* ssd16xx reported MONO10 until Zephyr b3150095671, so CFB flipped the
|
||||
* frame for us; it now reports MONO01 (a set RAM bit is a white pixel),
|
||||
* which CFB passes through as white text on a black page. Keyed on the
|
||||
* reported format so it is a no-op against a driver that still says
|
||||
* MONO10. mc_display_text()'s invert toggles are relative to this. */
|
||||
if (is_epd && caps.current_pixel_format == PIXEL_FORMAT_MONO01) {
|
||||
cfb_framebuffer_invert(disp_dev);
|
||||
}
|
||||
|
||||
/* Clear CPU-side framebuffer (zeroes the RAM buffer — no SPI transfer). */
|
||||
cfb_framebuffer_clear(disp_dev, false);
|
||||
|
||||
|
||||
@@ -620,6 +620,43 @@ a bench that exercises them. Validated so far, on a Wio Tracker
|
||||
L1 and a T1000-E: 50/50 packet parity with the v4.4 build in both directions,
|
||||
with RX duty cycle off (2 s gap) and on (2 s and 800 ms gaps).
|
||||
|
||||
== Rebased onto the GFSK refactor (2026-10-02, upstream aad9dceddea) ==
|
||||
|
||||
Upstream added a GFSK modem to the driver and, to share code with it, split
|
||||
sx126x_lora_config() into sx126x_config_begin() and sx126x_config_carrier(),
|
||||
replaced the open-coded SetPacketParams calls with
|
||||
sx126x_set_configured_packet_params(), and made sx126x_set_packet_type(),
|
||||
sx126x_set_rx_gain() and sx126x_set_sleep() non-static for sx126x_gfsk.c.
|
||||
Ten conflict hunks, all in sx126x.c. The patch follows upstream's new shape
|
||||
rather than reverting it:
|
||||
|
||||
- sx126x_config_carrier() is upstream's, with one change: it passes
|
||||
SX126X_TX_RAMP_TIME instead of SX126X_RAMP_200_US, so the "every site that
|
||||
programs TX power agrees on the ramp" rule above still holds, GFSK included.
|
||||
- sx126x_lora_config() calls sx126x_config_carrier() and then
|
||||
sx126x_apply_agc_band_cal(). Before the rebase the band calibration ran
|
||||
between SetRfFrequency and SetTxParams; the two are independent, and the
|
||||
only ordering that matters (band cal before the RX-gain write) is kept.
|
||||
- Upstream now issues SetPacketType(LORA) on every config, not only at chip
|
||||
init. Taken as-is. DS Sec 13.4.2 wants it first in the sequence, which it
|
||||
is; everything it could reset (modulation params, sync word, RX gain) is
|
||||
written after it in the same function, and packet params are written per
|
||||
RX/TX.
|
||||
- sx126x_apply_tx_modulation_workaround() takes a bool (500 kHz LoRa or not)
|
||||
upstream; our extra call in sx126x_lora_config() passes
|
||||
config->bandwidth == BW_500_KHZ. A plain 3-way merge leaves the enum there,
|
||||
which compiles and is wrong for every bandwidth.
|
||||
- sx126x_get_packet_status() keeps upstream's GFSK branch ahead of our 3-byte
|
||||
LoRa read.
|
||||
- The send path keeps upstream's fixed-length GFSK check and uses
|
||||
sx126x_set_configured_packet_params(); our duty-cycle start still calls
|
||||
sx126x_set_packet_params() directly (LoRa only, as before).
|
||||
- Upstream's duty-cycle functions stay deleted, as since 2026-09-19, and the
|
||||
API table gains .config_gfsk under CONFIG_LORA_GFSK.
|
||||
|
||||
CONFIG_LORA_GFSK is off in every ZephCore build, so sx126x_gfsk.c is not
|
||||
compiled and SX126X_IS_GFSK() is constant false.
|
||||
|
||||
== Why this is one patch ==
|
||||
|
||||
Five of the sections above shipped as separate files (0011 band-rssi-cal, 0012
|
||||
@@ -662,10 +699,10 @@ Regenerate with:
|
||||
appended to this preamble.
|
||||
|
||||
diff --git a/drivers/lora/native/sx126x/sx126x.c b/drivers/lora/native/sx126x/sx126x.c
|
||||
index c8e682ee84c..bcf68246b03 100644
|
||||
index d3a7313e964..7c812a927b8 100644
|
||||
--- a/drivers/lora/native/sx126x/sx126x.c
|
||||
+++ b/drivers/lora/native/sx126x/sx126x.c
|
||||
@@ -6,14 +6,53 @@
|
||||
@@ -6,15 +6,54 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/drivers/lora.h>
|
||||
@@ -674,6 +711,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
#include <zephyr/sys/byteorder.h>
|
||||
|
||||
#include "sx126x.h"
|
||||
#include "sx126x_gfsk.h"
|
||||
+#include <zephyr/drivers/lora/sx126x_ext.h>
|
||||
+#include <zephyr/drivers/lora/zc_lora_timing.h>
|
||||
|
||||
@@ -719,7 +757,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
#define SX126X_REST_STATE \
|
||||
(IS_ENABLED(CONFIG_LORA_SX126X_NATIVE_SLEEP) \
|
||||
? SX126X_STATE_SLEEP : SX126X_STATE_IDLE)
|
||||
@@ -96,6 +135,82 @@ static int bandwidth_to_hz(enum lora_signal_bandwidth bw, uint32_t *bw_hz)
|
||||
@@ -103,6 +142,82 @@ static int bandwidth_to_hz(enum lora_signal_bandwidth bw, uint32_t *bw_hz)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -802,11 +840,11 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
static bool should_enable_ldro(enum lora_datarate sf, enum lora_signal_bandwidth bw,
|
||||
const struct sx126x_hal_config *config)
|
||||
{
|
||||
@@ -336,10 +451,128 @@ static int sx126x_set_sync_word(const struct device *dev, const struct lora_mode
|
||||
@@ -347,10 +462,128 @@ static int sx126x_set_sync_word(const struct device *dev, const struct lora_mode
|
||||
return sx126x_hal_write_regs(dev, SX126X_REG_LORA_SYNC_WORD_MSB, buf, 2);
|
||||
}
|
||||
|
||||
-static int sx126x_set_rx_gain(const struct device *dev, bool boosted)
|
||||
-int sx126x_set_rx_gain(const struct device *dev, bool boosted)
|
||||
+/* RSSI / AGC band calibration (DS Sec 6.1.6, Table 6-4).
|
||||
+ *
|
||||
+ * Semtech: "The power seen by the SX1261/2 analog front-end is affected by
|
||||
@@ -916,7 +954,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
+ return SX126X_RX_GAIN_VAL(data->agc_sensi_adjust, boosted);
|
||||
+}
|
||||
|
||||
+static int sx126x_set_rx_gain(const struct device *dev, bool boosted)
|
||||
+int sx126x_set_rx_gain(const struct device *dev, bool boosted)
|
||||
+{
|
||||
+ uint8_t val = sx126x_rx_gain_byte(dev, boosted);
|
||||
+
|
||||
@@ -933,16 +971,16 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
return sx126x_hal_write_regs(dev, SX126X_REG_RX_GAIN, &val, 1);
|
||||
}
|
||||
|
||||
@@ -415,7 +648,7 @@ static int sx126x_get_packet_status(const struct device *dev,
|
||||
uint8_t buf[3];
|
||||
int ret;
|
||||
@@ -445,7 +678,7 @@ static int sx126x_get_packet_status(const struct device *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
- ret = sx126x_hal_read_cmd(dev, SX126X_CMD_GET_PACKET_STATUS, buf, 2);
|
||||
+ ret = sx126x_hal_read_cmd(dev, SX126X_CMD_GET_PACKET_STATUS, buf, 3);
|
||||
if (ret == 0) {
|
||||
/* RSSI is -value/2 dBm */
|
||||
*rssi = -((int16_t)buf[0] >> 1);
|
||||
@@ -443,6 +676,12 @@ static int sx126x_add_reg_to_retention(const struct device *dev, uint16_t addr)
|
||||
@@ -473,6 +706,12 @@ static int sx126x_add_reg_to_retention(const struct device *dev, uint16_t addr)
|
||||
|
||||
n = buf[0];
|
||||
|
||||
@@ -955,7 +993,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
for (uint8_t i = 0; i < n; i++) {
|
||||
if (sys_get_be16(&buf[1 + 2 * i]) == addr) {
|
||||
return 0;
|
||||
@@ -460,6 +699,92 @@ static int sx126x_add_reg_to_retention(const struct device *dev, uint16_t addr)
|
||||
@@ -490,6 +729,92 @@ static int sx126x_add_reg_to_retention(const struct device *dev, uint16_t addr)
|
||||
return sx126x_hal_write_regs(dev, SX126X_REG_RETENTION_LIST, buf, sizeof(buf));
|
||||
}
|
||||
|
||||
@@ -1048,7 +1086,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
static int sx126x_chip_init(const struct device *dev)
|
||||
{
|
||||
const struct sx126x_hal_config *config = dev->config;
|
||||
@@ -520,6 +845,26 @@ static int sx126x_chip_init(const struct device *dev)
|
||||
@@ -550,6 +875,26 @@ static int sx126x_chip_init(const struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1075,7 +1113,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
/* Set packet type to LoRa */
|
||||
ret = sx126x_set_packet_type(dev, SX126X_PACKET_TYPE_LORA);
|
||||
if (ret < 0) {
|
||||
@@ -527,10 +872,23 @@ static int sx126x_chip_init(const struct device *dev)
|
||||
@@ -557,10 +902,23 @@ static int sx126x_chip_init(const struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1102,7 +1140,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Set IRQ params failed: %d", ret);
|
||||
return ret;
|
||||
@@ -543,21 +901,9 @@ static int sx126x_chip_init(const struct device *dev)
|
||||
@@ -573,21 +931,9 @@ static int sx126x_chip_init(const struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1127,7 +1165,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
|
||||
LOG_INF("SX126x initialized");
|
||||
return 0;
|
||||
@@ -567,15 +913,44 @@ static void sx126x_dio1_callback(const struct device *dev)
|
||||
@@ -597,15 +943,44 @@ static void sx126x_dio1_callback(const struct device *dev)
|
||||
{
|
||||
struct sx126x_data *data = dev->data;
|
||||
|
||||
@@ -1174,7 +1212,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
sx126x_hal_set_rf_switch(dev, enable, tx);
|
||||
}
|
||||
}
|
||||
@@ -595,6 +970,7 @@ static void sx126x_disconnect_rf_gpios(const struct device *dev)
|
||||
@@ -625,6 +1000,7 @@ static void sx126x_disconnect_rf_gpios(const struct device *dev)
|
||||
sx126x_disconnect_gpio(&config->antenna_enable);
|
||||
sx126x_disconnect_gpio(&config->tx_enable);
|
||||
sx126x_disconnect_gpio(&config->rx_enable);
|
||||
@@ -1182,7 +1220,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
}
|
||||
|
||||
static int sx126x_reconnect_rf_gpios(const struct device *dev)
|
||||
@@ -620,10 +996,232 @@ static int sx126x_reconnect_rf_gpios(const struct device *dev)
|
||||
@@ -650,10 +1026,232 @@ static int sx126x_reconnect_rf_gpios(const struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1412,10 +1450,10 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
+ K_MSEC(sx126x_dc_watchdog_ms(data)));
|
||||
+}
|
||||
+
|
||||
static int sx126x_set_sleep(const struct device *dev)
|
||||
int sx126x_set_sleep(const struct device *dev)
|
||||
{
|
||||
struct sx126x_data *data = dev->data;
|
||||
@@ -697,94 +1295,214 @@ static void sx126x_handle_irq_tx_done(const struct device *dev)
|
||||
@@ -727,94 +1325,214 @@ static void sx126x_handle_irq_tx_done(const struct device *dev)
|
||||
k_msgq_put(&data->tx_msgq, &result, K_NO_WAIT);
|
||||
}
|
||||
|
||||
@@ -1690,7 +1728,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -827,13 +1545,100 @@ static void sx126x_irq_work_handler(struct k_work *work)
|
||||
@@ -857,13 +1575,100 @@ static void sx126x_irq_work_handler(struct k_work *work)
|
||||
}
|
||||
|
||||
if (irq_status & SX126X_IRQ_RX_DONE) {
|
||||
@@ -1791,7 +1829,16 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
/* Re-enable the DIO1 interrupt for the next event (unless sleeping) */
|
||||
if (atomic_get(&data->state) != SX126X_REST_STATE) {
|
||||
sx126x_hal_dio1_irq_enable(dev);
|
||||
@@ -894,10 +1699,19 @@ static int sx126x_lora_config(const struct device *dev,
|
||||
@@ -921,7 +1726,7 @@ int sx126x_config_carrier(const struct device *dev, uint32_t frequency, int8_t t
|
||||
return ret;
|
||||
}
|
||||
|
||||
- return sx126x_hal_configure_tx_params(dev, tx_power, frequency, SX126X_RAMP_200_US);
|
||||
+ return sx126x_hal_configure_tx_params(dev, tx_power, frequency, SX126X_TX_RAMP_TIME);
|
||||
}
|
||||
|
||||
static int sx126x_lora_config(const struct device *dev, const struct lora_modem_config *config)
|
||||
@@ -975,6 +1780,15 @@ static int sx126x_lora_config(const struct device *dev, const struct lora_modem_
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1804,20 +1851,15 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
/* Configure PA and TX power based on chip variant and frequency */
|
||||
ret = sx126x_hal_configure_tx_params(dev, config->tx_power,
|
||||
config->frequency,
|
||||
- SX126X_RAMP_200_US);
|
||||
+ SX126X_TX_RAMP_TIME);
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
}
|
||||
@@ -915,6 +1729,12 @@ static int sx126x_lora_config(const struct device *dev,
|
||||
/* Set modulation parameters */
|
||||
ret = bandwidth_to_reg(config->bandwidth, &bw_reg);
|
||||
__ASSERT_NO_MSG(ret == 0);
|
||||
@@ -985,6 +1799,12 @@ static int sx126x_lora_config(const struct device *dev, const struct lora_modem_
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ /* Sec 15.1 TX Modulation workaround (datasheet errata). */
|
||||
+ ret = sx126x_apply_tx_modulation_workaround(dev, config->bandwidth);
|
||||
+ ret = sx126x_apply_tx_modulation_workaround(dev, config->bandwidth == BW_500_KHZ);
|
||||
+ if (ret < 0) {
|
||||
+ goto out;
|
||||
+ }
|
||||
@@ -1825,7 +1867,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
/* Set sync word */
|
||||
ret = sx126x_set_sync_word(dev, config);
|
||||
if (ret < 0) {
|
||||
@@ -938,6 +1758,10 @@ out:
|
||||
@@ -1009,6 +1829,10 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1836,7 +1878,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
static int sx126x_lora_send_async(const struct device *dev,
|
||||
uint8_t *data_buf, uint32_t data_len,
|
||||
struct k_poll_signal *async)
|
||||
@@ -955,11 +1779,27 @@ static int sx126x_lora_send_async(const struct device *dev,
|
||||
@@ -1036,11 +1860,27 @@ static int sx126x_lora_send_async(const struct device *dev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1866,7 +1908,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
k_mutex_lock(&data->lock, K_FOREVER);
|
||||
|
||||
ret = sx126x_ensure_ready(dev);
|
||||
@@ -969,12 +1809,65 @@ static int sx126x_lora_send_async(const struct device *dev,
|
||||
@@ -1050,10 +1890,63 @@ static int sx126x_lora_send_async(const struct device *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1874,8 +1916,6 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
- k_msgq_purge(&data->tx_msgq);
|
||||
-
|
||||
- /* Set packet parameters */
|
||||
- ret = sx126x_set_packet_params(dev,
|
||||
- data->config.preamble_len,
|
||||
+ /* LBT: perform blocking CAD before transmitting */
|
||||
+ if (data->config.cad.mode == LORA_CAD_MODE_LBT) {
|
||||
+ k_mutex_unlock(&data->lock);
|
||||
@@ -1933,12 +1973,10 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
+ k_msgq_purge(&data->tx_msgq);
|
||||
+
|
||||
+ /* Set packet parameters */
|
||||
+ ret = sx126x_set_packet_params(dev,
|
||||
+ data->config.preamble_len,
|
||||
SX126X_LORA_HEADER_EXPLICIT,
|
||||
data_len,
|
||||
data->config.packet_crc_disable ?
|
||||
@@ -999,8 +1892,90 @@ static int sx126x_lora_send_async(const struct device *dev,
|
||||
ret = sx126x_set_configured_packet_params(dev, data_len);
|
||||
if (ret < 0) {
|
||||
goto out_error;
|
||||
@@ -1074,8 +1967,90 @@ static int sx126x_lora_send_async(const struct device *dev,
|
||||
/* Enable antenna and set TX path */
|
||||
sx126x_set_rf_path(dev, true, true);
|
||||
|
||||
@@ -2031,7 +2069,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
if (ret < 0) {
|
||||
goto out_error;
|
||||
}
|
||||
@@ -1069,6 +2044,8 @@ static int sx126x_lora_recv(const struct device *dev, uint8_t *data_buf,
|
||||
@@ -1144,6 +2119,8 @@ static int sx126x_lora_recv(const struct device *dev, uint8_t *data_buf,
|
||||
}
|
||||
|
||||
data->rx_cb = NULL;
|
||||
@@ -2040,7 +2078,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
k_msgq_purge(&data->rx_msgq);
|
||||
|
||||
/* Set packet parameters for variable length reception */
|
||||
@@ -1140,6 +2117,8 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
@@ -1208,6 +2185,8 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
/* Stop async reception */
|
||||
data->rx_cb = NULL;
|
||||
data->rx_cb_user_data = NULL;
|
||||
@@ -2049,7 +2087,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
if (atomic_cas(&data->state, SX126X_STATE_RX, SX126X_STATE_IDLE)) {
|
||||
sx126x_set_standby(dev, SX126X_STANDBY_RC);
|
||||
sx126x_set_sleep(dev);
|
||||
@@ -1154,6 +2133,19 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
@@ -1222,6 +2201,19 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -2069,7 +2107,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
if (!atomic_cas(&data->state, SX126X_REST_STATE, SX126X_STATE_RX)) {
|
||||
LOG_ERR("Busy");
|
||||
k_mutex_unlock(&data->lock);
|
||||
@@ -1167,8 +2159,18 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
@@ -1235,13 +2227,24 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2087,16 +2125,14 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
+ data->rx_duty_cycle_enabled = false;
|
||||
|
||||
/* Set packet parameters */
|
||||
ret = sx126x_set_packet_params(dev,
|
||||
@@ -1181,6 +2183,7 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
SX126X_LORA_IQ_INVERTED : SX126X_LORA_IQ_STANDARD);
|
||||
ret = sx126x_set_configured_packet_params(dev, SX126X_MAX_PAYLOAD_LEN);
|
||||
if (ret < 0) {
|
||||
data->rx_cb = NULL;
|
||||
+ atomic_inc(&data->rx_cb_gen);
|
||||
sx126x_set_sleep(dev);
|
||||
k_mutex_unlock(&data->lock);
|
||||
return ret;
|
||||
@@ -1193,11 +2196,21 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
@@ -1254,11 +2257,21 @@ static int sx126x_lora_recv_async(const struct device *dev,
|
||||
ret = sx126x_set_rx(dev, 0);
|
||||
if (ret < 0) {
|
||||
data->rx_cb = NULL;
|
||||
@@ -2118,7 +2154,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
k_mutex_unlock(&data->lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -1255,159 +2268,6 @@ static void sx126x_duty_cycle_stop(const struct device *dev)
|
||||
@@ -1316,151 +2329,6 @@ static void sx126x_duty_cycle_stop(const struct device *dev)
|
||||
sx126x_set_sleep(dev);
|
||||
}
|
||||
|
||||
@@ -2134,15 +2170,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
- data->duty_cycle.sleep_period = SX126X_MS_TO_TIMEOUT(
|
||||
- k_ticks_to_ms_ceil32(sleep_period.ticks));
|
||||
-
|
||||
- ret = sx126x_set_packet_params(dev,
|
||||
- data->config.preamble_len,
|
||||
- SX126X_LORA_HEADER_EXPLICIT,
|
||||
- SX126X_MAX_PAYLOAD_LEN,
|
||||
- data->config.packet_crc_disable ?
|
||||
- SX126X_LORA_CRC_OFF : SX126X_LORA_CRC_ON,
|
||||
- data->config.iq_inverted ?
|
||||
- SX126X_LORA_IQ_INVERTED :
|
||||
- SX126X_LORA_IQ_STANDARD);
|
||||
- ret = sx126x_set_configured_packet_params(dev, SX126X_MAX_PAYLOAD_LEN);
|
||||
- if (ret < 0) {
|
||||
- goto out_error;
|
||||
- }
|
||||
@@ -2278,7 +2306,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
static uint32_t sx126x_lora_airtime(const struct device *dev, uint32_t data_len)
|
||||
{
|
||||
struct sx126x_data *data = dev->data;
|
||||
@@ -1491,7 +2351,7 @@ static int sx126x_lora_test_cw(const struct device *dev, uint32_t frequency,
|
||||
@@ -1560,7 +2428,7 @@ static int sx126x_lora_test_cw(const struct device *dev, uint32_t frequency,
|
||||
|
||||
/* Set PA config and TX power */
|
||||
ret = sx126x_hal_configure_tx_params(dev, tx_power, frequency,
|
||||
@@ -2287,12 +2315,15 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
if (ret < 0) {
|
||||
goto out_sleep;
|
||||
}
|
||||
@@ -1523,50 +2383,1122 @@ out_unlock:
|
||||
@@ -1592,53 +2460,1125 @@ out_unlock:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static DEVICE_API(lora, sx126x_lora_api) = {
|
||||
- .config = sx126x_lora_config,
|
||||
-#ifdef CONFIG_LORA_GFSK
|
||||
- .config_gfsk = sx126x_lora_config_gfsk,
|
||||
-#endif
|
||||
- .send = sx126x_lora_send,
|
||||
- .send_async = sx126x_lora_send_async,
|
||||
- .recv = sx126x_lora_recv,
|
||||
@@ -3375,6 +3406,9 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
+
|
||||
+static DEVICE_API(lora, sx126x_lora_api) = {
|
||||
+ .config = sx126x_lora_config,
|
||||
+#ifdef CONFIG_LORA_GFSK
|
||||
+ .config_gfsk = sx126x_lora_config_gfsk,
|
||||
+#endif
|
||||
+ .send = sx126x_lora_send,
|
||||
+ .send_async = sx126x_lora_send_async,
|
||||
+ .recv = sx126x_lora_recv,
|
||||
@@ -3446,7 +3480,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
|
||||
/* Initialize HAL */
|
||||
ret = sx126x_hal_init(dev);
|
||||
@@ -1628,6 +3560,8 @@ static int sx126x_init(const struct device *dev)
|
||||
@@ -1700,6 +3640,8 @@ static int sx126x_init(const struct device *dev)
|
||||
{0}), \
|
||||
.rx_enable = GPIO_DT_SPEC_INST_GET_OR(inst, rx_enable_gpios, \
|
||||
{0}), \
|
||||
@@ -3455,7 +3489,7 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
.dio2_tx_enable = DT_INST_PROP(inst, dio2_tx_enable), \
|
||||
.dio3_tcxo_enable = DT_INST_NODE_HAS_PROP(inst, dio3_tcxo_voltage), \
|
||||
.dio3_tcxo_voltage = DT_INST_PROP_OR(inst, dio3_tcxo_voltage, 0), \
|
||||
@@ -1682,6 +3616,8 @@ DT_INST_FOREACH_STATUS_OKAY_VARGS(SX126X_INIT, true)
|
||||
@@ -1754,6 +3696,8 @@ DT_INST_FOREACH_STATUS_OKAY_VARGS(SX126X_INIT, true)
|
||||
{0}), \
|
||||
.rx_enable = GPIO_DT_SPEC_INST_GET_OR(inst, rx_enable_gpios, \
|
||||
{0}), \
|
||||
@@ -3465,10 +3499,10 @@ index c8e682ee84c..bcf68246b03 100644
|
||||
.dio3_tcxo_enable = DT_INST_NODE_HAS_PROP(inst, dio3_tcxo_voltage), \
|
||||
.dio3_tcxo_voltage = DT_INST_PROP_OR(inst, dio3_tcxo_voltage, 0), \
|
||||
diff --git a/drivers/lora/native/sx126x/sx126x.h b/drivers/lora/native/sx126x/sx126x.h
|
||||
index 0122958c32a..9d39100a713 100644
|
||||
index 07c50f0044d..fccb7e63228 100644
|
||||
--- a/drivers/lora/native/sx126x/sx126x.h
|
||||
+++ b/drivers/lora/native/sx126x/sx126x.h
|
||||
@@ -57,6 +57,7 @@ struct sx126x_data {
|
||||
@@ -62,6 +62,7 @@ struct sx126x_data {
|
||||
/* Async RX callback */
|
||||
lora_recv_cb rx_cb;
|
||||
void *rx_cb_user_data;
|
||||
@@ -3476,7 +3510,7 @@ index 0122958c32a..9d39100a713 100644
|
||||
|
||||
/* RX duty cycle parameters (in SX126x timeout ticks) */
|
||||
struct {
|
||||
@@ -69,7 +70,133 @@ struct sx126x_data {
|
||||
@@ -74,7 +75,133 @@ struct sx126x_data {
|
||||
|
||||
/* Deferred work for interrupt handling */
|
||||
struct k_work irq_work;
|
||||
@@ -3609,7 +3643,7 @@ index 0122958c32a..9d39100a713 100644
|
||||
+ uint8_t cad_probe_peak;
|
||||
};
|
||||
|
||||
#endif /* ZEPHYR_DRIVERS_LORA_SX126X_SX126X_INTERNAL_H_ */
|
||||
int sx126x_set_packet_type(const struct device *dev, uint8_t type);
|
||||
diff --git a/drivers/lora/native/sx126x/sx126x_hal.c b/drivers/lora/native/sx126x/sx126x_hal.c
|
||||
index 34f7089584f..7093bf6b622 100644
|
||||
--- a/drivers/lora/native/sx126x/sx126x_hal.c
|
||||
@@ -3761,10 +3795,10 @@ index b7ffbac7a6e..382acfc50b9 100644
|
||||
return 0;
|
||||
}
|
||||
diff --git a/drivers/lora/native/sx126x/sx126x_regs.h b/drivers/lora/native/sx126x/sx126x_regs.h
|
||||
index 1e6146f751f..03e72ff9025 100644
|
||||
index 9b342f473f3..4bec2f736be 100644
|
||||
--- a/drivers/lora/native/sx126x/sx126x_regs.h
|
||||
+++ b/drivers/lora/native/sx126x/sx126x_regs.h
|
||||
@@ -175,10 +175,34 @@
|
||||
@@ -244,10 +244,34 @@
|
||||
#define SX126X_LORA_SYNC_WORD_PUBLIC 0x3444
|
||||
#define SX126X_LORA_SYNC_WORD_PRIVATE 0x1424
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ manifest:
|
||||
projects:
|
||||
- name: zephyr
|
||||
remote: zephyrproject-rtos
|
||||
revision: 1ee3b93134be23c16ab16b9eb4183bfef63447a6
|
||||
revision: ac03a4a9085d436d57cd2c5723f0616cfa709ab7
|
||||
import: true
|
||||
|
||||
self:
|
||||
|
||||
Reference in New Issue
Block a user