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 3333extern "C" {
3434#endif
3535
36+ #if defined(DOXYGEN )
37+ /**
38+ * @brief Configure the LoRa sync word
39+ *
40+ * The sync word for sx126x is 16 bits long.
41+ * Private networks should use 0x1424.
42+ * Public networks should use 0x3444.
43+ * Using the driver API you only configure 2 nibbles Y and Z to form a sync word 0xY4Z4.
44+ * The default chip value is 0x12 (0x1424).
45+ *
46+ * See https://blog.classycode.com/lora-sync-word-compatibility-between-sx127x-and-sx126x-460324d1787a
47+ * for more information and a comparison with sx127x.
48+ */
49+ # define CONFIG_SX126X_DEFAULT_SYNC_WORD 0x12
50+ #endif
51+
3652/**
3753 * * @note Forward declaration of the SX126x device descriptor
3854 */
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