drivers: lora: Add support for setting sync-word and iq-inverted
Add support for setting sync-word and iq-inverted in lora_modem_config. By being able to set the sync-word it's possible to send "raw" public-network packets using lora_send and using iq-inverted both uplink and downlink messages can be sent. Signed-off-by: Tim Cooijmans <timcooijmans@gmail.com>
This commit is contained in:
parent
b85fdf57a4
commit
4c285fc53c
2 changed files with 24 additions and 2 deletions
|
@ -316,15 +316,17 @@ int sx12xx_lora_config(const struct device *dev,
|
||||||
Radio.SetTxConfig(MODEM_LORA, config->tx_power, 0,
|
Radio.SetTxConfig(MODEM_LORA, config->tx_power, 0,
|
||||||
config->bandwidth, config->datarate,
|
config->bandwidth, config->datarate,
|
||||||
config->coding_rate, config->preamble_len,
|
config->coding_rate, config->preamble_len,
|
||||||
false, true, 0, 0, false, 4000);
|
false, true, 0, 0, config->iq_inverted, 4000);
|
||||||
} else {
|
} else {
|
||||||
/* TODO: Get symbol timeout value from config parameters */
|
/* TODO: Get symbol timeout value from config parameters */
|
||||||
Radio.SetRxConfig(MODEM_LORA, config->bandwidth,
|
Radio.SetRxConfig(MODEM_LORA, config->bandwidth,
|
||||||
config->datarate, config->coding_rate,
|
config->datarate, config->coding_rate,
|
||||||
0, config->preamble_len, 10, false, 0,
|
0, config->preamble_len, 10, false, 0,
|
||||||
false, 0, 0, false, true);
|
false, 0, 0, config->iq_inverted, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Radio.SetPublicNetwork(config->public_network);
|
||||||
|
|
||||||
modem_release(&dev_data);
|
modem_release(&dev_data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,26 @@ struct lora_modem_config {
|
||||||
|
|
||||||
/* Set to true for transmission, false for receiving */
|
/* Set to true for transmission, false for receiving */
|
||||||
bool tx;
|
bool tx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invert the In-Phase and Quadrature (IQ) signals. Normally this
|
||||||
|
* should be set to false. In advanced use-cases where a
|
||||||
|
* differentation is needed between "uplink" and "downlink" traffic,
|
||||||
|
* the IQ can be inverted to create two different channels on the
|
||||||
|
* same frequency
|
||||||
|
*/
|
||||||
|
bool iq_inverted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the sync-byte to use:
|
||||||
|
* - false: for using the private network sync-byte
|
||||||
|
* - true: for using the public network sync-byte
|
||||||
|
* The public network sync-byte is only intended for advanced usage.
|
||||||
|
* Normally the private network sync-byte should be used for peer
|
||||||
|
* to peer communications and the LoRaWAN APIs should be used for
|
||||||
|
* interacting with a public network.
|
||||||
|
*/
|
||||||
|
bool public_network;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue