1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

drivers/sx127x: add NETOPT_SYNCWORD option handling

This commit is contained in:
Jose Alamos 2019-03-07 16:35:18 +01:00
parent 14f91388bd
commit 77162b8c6f
3 changed files with 16 additions and 0 deletions

View File

@ -351,6 +351,11 @@ static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len)
*((int16_t*) val) = (int16_t)sx127x_get_tx_power(dev);
return sizeof(int16_t);
case NETOPT_SYNCWORD:
assert(max_len >= sizeof(uint8_t));
*((uint8_t*) val) = (uint8_t) sx127x_get_syncword(dev);
return sizeof(uint8_t);
case NETOPT_IQ_INVERT:
assert(max_len >= sizeof(uint8_t));
*((netopt_enable_t*) val) = sx127x_get_iq_invert(dev) ? NETOPT_ENABLE : NETOPT_DISABLE;
@ -480,6 +485,11 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *val, size_t len)
sx127x_set_preamble_length(dev, *((const uint16_t*) val));
return sizeof(uint16_t);
case NETOPT_SYNCWORD:
assert(len <= sizeof(uint8_t));
sx127x_set_syncword(dev, *((uint8_t*) val));
return sizeof(uint8_t);
case NETOPT_IQ_INVERT:
assert(len <= sizeof(netopt_enable_t));
sx127x_set_iq_invert(dev, *((const netopt_enable_t*) val) ? true : false);

View File

@ -645,6 +645,11 @@ typedef enum {
*/
NETOPT_LORAWAN_MIN_RX_SYMBOL,
/**
* @brief (uint8_t*) phy layer syncword
*/
NETOPT_SYNCWORD,
/* add more options if needed */
/**

View File

@ -106,6 +106,7 @@ static const char *_netopt_strmap[] = {
[NETOPT_LORAWAN_RX2_FREQ] = "NETOPT_LORAWAN_RX2_FREQ",
[NETOPT_LORAWAN_MAX_RX_ERROR] = "NETOPT_LORAWAN_MAX_RX_ERROR",
[NETOPT_LORAWAN_MIN_RX_SYMBOL] = "NETOPT_LORAWAN_MIN_RX_SYMBOL",
[NETOPT_SYNCWORD] = "NETOPT_SYNCWORD",
[NETOPT_NUMOF] = "NETOPT_NUMOF",
};