2016-05-20 17:13:31 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Phytec Messtechnik GmbH
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2017-01-23 11:06:37 +01:00
|
|
|
* @ingroup drivers_kw2xrf
|
2016-05-20 17:13:31 +02:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief get/set interfaces for kw2xrf driver
|
|
|
|
*
|
|
|
|
* @author Johann Fischer <j.fischer@phytec.de>
|
|
|
|
*/
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
#ifndef KW2XRF_GETSET_H
|
|
|
|
#define KW2XRF_GETSET_H
|
|
|
|
|
2022-07-28 18:27:16 +02:00
|
|
|
#include "kw2xrf_reg.h"
|
2016-05-20 17:13:31 +02:00
|
|
|
#include "kw2xrf.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set tx power of given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] txpower transmit power in dBm
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_tx_power(kw2xrf_t *dev, int16_t txpower);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Get tx power value of given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
*
|
|
|
|
* @return current tx power value
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
uint16_t kw2xrf_get_txpower(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set channel of given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] val channel
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
int kw2xrf_set_channel(kw2xrf_t *dev, uint8_t val);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Get channel of given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
*
|
|
|
|
* @return current channel
|
|
|
|
*/
|
|
|
|
uint8_t kw2xrf_get_channel(kw2xrf_t *dev);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Abort current sequence of device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_abort_sequence(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set idle sequence state of device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_idle_sequence(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set sequence state of device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] seq sequence
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_sequence(kw2xrf_t *dev, kw2xrf_physeq_t seq);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set PAN ID of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] pan PAN ID value
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_pan(kw2xrf_t *dev, uint16_t pan);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set short address of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] addr short address
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_addr_short(kw2xrf_t *dev, uint16_t addr);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set long address of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] addr long address
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_addr_long(kw2xrf_t *dev, uint64_t addr);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Get short address of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @return current short address
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
uint16_t kw2xrf_get_addr_short(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Get long address of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @return current long address
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
uint64_t kw2xrf_get_addr_long(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
2019-09-14 15:47:10 +02:00
|
|
|
* @brief Get CCA threshold of a given device
|
2017-01-23 11:06:37 +01:00
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
2019-09-14 15:47:10 +02:00
|
|
|
* @return current CCA threshold
|
2017-01-23 11:06:37 +01:00
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
int8_t kw2xrf_get_cca_threshold(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set CCA threshold of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] value CCA threshold
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_cca_threshold(kw2xrf_t *dev, int8_t value);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set CCA mode of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] mode CCA mode
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_cca_mode(kw2xrf_t *dev, uint8_t mode);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Get CCA mode of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @return current CCA mode
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
uint8_t kw2xrf_get_cca_mode(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Get RSSI from LQI value
|
|
|
|
*
|
|
|
|
* @param[in] value Current LQI value
|
|
|
|
*
|
|
|
|
* @return deduced RSSI in dBm
|
|
|
|
*/
|
2017-08-30 22:30:24 +02:00
|
|
|
int16_t kw2xrf_get_rssi(uint32_t value);
|
2016-05-20 17:13:31 +02:00
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Get state of a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @return current state
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
netopt_state_t kw2xrf_get_status(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
2019-09-14 15:47:10 +02:00
|
|
|
* @brief Enable continuous CCA
|
2017-01-23 11:06:37 +01:00
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
*
|
|
|
|
* @return CCA value
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
int kw2xrf_cca(kw2xrf_t *dev);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set receive watermark
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] value watermark
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_rx_watermark(kw2xrf_t *dev, uint8_t value);
|
|
|
|
|
2017-01-23 11:06:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Set netopt a given device
|
|
|
|
*
|
|
|
|
* @param[in] dev kw2xrf device descriptor
|
|
|
|
* @param[in] option Netopt option type
|
|
|
|
* @param[in] state state
|
|
|
|
*/
|
2016-05-20 17:13:31 +02:00
|
|
|
void kw2xrf_set_option(kw2xrf_t *dev, uint16_t option, bool state);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2017-01-23 11:06:37 +01:00
|
|
|
|
|
|
|
#endif /* KW2XRF_GETSET_H */
|
2016-05-20 17:13:31 +02:00
|
|
|
/** @} */
|