Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions drivers/include/sx126x.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@
extern "C" {
#endif

#if defined(DOXYGEN)
/**
* @brief Configure the LoRa sync word
*
* The sync word for sx126x is 16 bits long.
* Private networks should use 0x1424.
* Public networks should use 0x3444.
* Using the driver API you only configure 2 nibbles Y and Z to form a sync word 0xY4Z4.
* The default chip value is 0x12 (0x1424).
*
* See https://blog.classycode.com/lora-sync-word-compatibility-between-sx127x-and-sx126x-460324d1787a

Check warning on line 46 in drivers/include/sx126x.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
* for more information and a comparison with sx127x.
*/
# define CONFIG_SX126X_DEFAULT_SYNC_WORD 0x12
#endif

/**
* * @note Forward declaration of the SX126x device descriptor
*/
Expand Down
3 changes: 3 additions & 0 deletions drivers/sx126x/sx126x.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ static void sx126x_init_default_config(sx126x_t *dev)
sx126x_set_pkt_type(dev, SX126X_PKT_TYPE_LORA);
sx126x_set_channel(dev, CONFIG_SX126X_CHANNEL_DEFAULT);
sx126x_set_tx_power(dev, CONFIG_SX126X_TX_POWER_DEFAULT, CONFIG_SX126X_RAMP_TIME_DEFAULT);
#ifdef CONFIG_SX126X_DEFAULT_SYNC_WORD
sx126x_set_lora_sync_word(dev, CONFIG_SX126X_DEFAULT_SYNC_WORD);
#endif

dev->mod_params.bw = (sx126x_lora_bw_t)(CONFIG_LORA_BW_DEFAULT + SX126X_LORA_BW_125);
dev->mod_params.sf = (sx126x_lora_sf_t)CONFIG_LORA_SF_DEFAULT;
Expand Down