mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/kw2xrf: turn test mode into a submodule
This commit is contained in:
parent
4a3231f763
commit
98455c265d
@ -1 +1,5 @@
|
||||
SUBMODULES := 1
|
||||
|
||||
SRC := kw2xrf.c kw2xrf_getset.c kw2xrf_intern.c kw2xrf_netdev.c kw2xrf_spi.c
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
@ -23,13 +23,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef KW2XRF_TESTMODE
|
||||
|
||||
#include "kw2xrf.h"
|
||||
#include "kw2xrf_reg.h"
|
||||
#include "kw2xrf_getset.h"
|
||||
#include "net/netopt.h"
|
||||
|
||||
/**
|
||||
* @brief Valid test modes to be used with @ref kw2xrf_set_test_mode.
|
||||
*/
|
||||
enum mkw2xrf_testmode {
|
||||
KW2XRF_TM_CTX_PREAMBLE = NETOPT_RF_TESTMODE_CTX_PRBS9 + 1,
|
||||
KW2XRF_TM_CTX_2MHZ,
|
||||
@ -40,10 +41,17 @@ enum mkw2xrf_testmode {
|
||||
KW2XRF_TM_CTX_NM1,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Set the test mode for the kw2xrf device.
|
||||
*
|
||||
* @param[in] dev Device descriptor
|
||||
* @param[in] mode Test mode (must be one of @ref mkw2xrf_testmode)
|
||||
*
|
||||
* @retval 1 on success
|
||||
* @retval != 1 otherwise
|
||||
*/
|
||||
int kw2xrf_set_test_mode(kw2xrf_t *dev, uint8_t mode);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -512,7 +512,7 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *value, size_t len)
|
||||
break;
|
||||
|
||||
case NETOPT_RF_TESTMODE:
|
||||
#ifdef KW2XRF_TESTMODE
|
||||
#ifdef MODULE_KW2XRF_TESTMODE
|
||||
if (len < sizeof(uint8_t)) {
|
||||
res = -EOVERFLOW;
|
||||
}
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include "kw2xrf_reg.h"
|
||||
#include "kw2xrf_tm.h"
|
||||
|
||||
#ifdef KW2XRF_TESTMODE
|
||||
|
||||
static inline void enable_xcvr_test_mode(kw2xrf_t *dev)
|
||||
{
|
||||
uint8_t reg;
|
||||
@ -58,7 +56,7 @@ int kw2xrf_set_test_mode(kw2xrf_t *dev, uint8_t mode)
|
||||
disable_xcvr_test_mode(dev);
|
||||
kw2xrf_set_channel(dev, dev->netdev.chan);
|
||||
|
||||
switch(mode) {
|
||||
switch (mode) {
|
||||
case NETOPT_RF_TESTMODE_IDLE:
|
||||
reg = 0;
|
||||
kw2xrf_write_iregs(dev, MKW2XDMI_TX_MODE_CTRL, ®, 1);
|
||||
@ -177,5 +175,4 @@ int kw2xrf_set_test_mode(kw2xrf_t *dev, uint8_t mode)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
|
Loading…
Reference in New Issue
Block a user