File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 2727extern "C" {
2828#endif
2929
30+ #if defined(DOXYGEN )
31+ /**
32+ * @brief Configure the LoRa sync word
33+ *
34+ * The sync word for sx126x is 16 bits long.
35+ * Private networks should use 0x1424.
36+ * Public networks should use 0x3444.
37+ * Using the driver API you only configure 2 nibbles Y and Z to form a sync word 0xY4Z4.
38+ * The default chip value is 0x12 (0x1424).
39+ *
40+ * See https://blog.classycode.com/lora-sync-word-compatibility-between-sx127x-and-sx126x-460324d1787a
41+ * for more information and a comparison with sx127x.
42+ */
43+ # define CONFIG_SX126X_DEFAULT_SYNC_WORD 0x12
44+ #endif
45+
3046/**
3147 * @brief Check whether the device model is sx1261
3248 *
Original file line number Diff line number Diff line change @@ -291,6 +291,9 @@ static void sx126x_init_default_config(sx126x_t *dev)
291291 sx126x_set_pkt_type (dev , SX126X_PKT_TYPE_LORA );
292292 sx126x_set_channel (dev , CONFIG_SX126X_CHANNEL_DEFAULT );
293293 sx126x_set_tx_power (dev , CONFIG_SX126X_TX_POWER_DEFAULT , CONFIG_SX126X_RAMP_TIME_DEFAULT );
294+ #ifdef CONFIG_SX126X_DEFAULT_SYNC_WORD
295+ sx126x_set_lora_sync_word (dev , CONFIG_SX126X_DEFAULT_SYNC_WORD );
296+ #endif
294297
295298 dev -> mod_params .bw = (sx126x_lora_bw_t )(CONFIG_LORA_BW_DEFAULT + SX126X_LORA_BW_125 );
296299 dev -> mod_params .sf = (sx126x_lora_sf_t )CONFIG_LORA_SF_DEFAULT ;
You can’t perform that action at this time.
0 commit comments