mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/ieee802154_hal: add support for MRF24j40 radios
This commit is contained in:
parent
f75631026b
commit
62e470d8c9
11
tests/ieee802154_hal/Makefile.ci
Normal file
11
tests/ieee802154_hal/Makefile.ci
Normal file
@ -0,0 +1,11 @@
|
||||
BOARD_INSUFFICIENT_MEMORY := \
|
||||
arduino-duemilanove \
|
||||
arduino-leonardo \
|
||||
arduino-nano \
|
||||
arduino-uno \
|
||||
atmega328p \
|
||||
atmega328p-xplained-mini\
|
||||
nucleo-f031k6 \
|
||||
nucleo-l011k4 \
|
||||
stm32f030f4-demo \
|
||||
#
|
@ -28,6 +28,7 @@
|
||||
#define RADIOS_NUMOF IS_USED(MODULE_CC2538_RF) + \
|
||||
IS_USED(MODULE_NRF802154) + \
|
||||
SOCKET_ZEP_MAX + \
|
||||
IS_USED(MODULE_MRF24J40) + \
|
||||
IS_USED(MODULE_KW2XRF)
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -44,6 +45,7 @@ typedef enum {
|
||||
IEEE802154_DEV_TYPE_NRF802154,
|
||||
IEEE802154_DEV_TYPE_SOCKET_ZEP,
|
||||
IEEE802154_DEV_TYPE_KW2XRF,
|
||||
IEEE802154_DEV_TYPE_MRF24J40,
|
||||
} ieee802154_dev_type_t;
|
||||
|
||||
typedef ieee802154_dev_t* (*ieee802154_dev_cb_t)(ieee802154_dev_type_t type,
|
||||
|
@ -38,19 +38,31 @@
|
||||
#include "socket_zep_params.h"
|
||||
#endif
|
||||
|
||||
#include "event/thread.h"
|
||||
extern void auto_init_event_thread(void);
|
||||
|
||||
#ifdef MODULE_KW2XRF
|
||||
#include "kw2xrf.h"
|
||||
#include "kw2xrf_params.h"
|
||||
#include "event/thread.h"
|
||||
#define KW2XRF_NUM ARRAY_SIZE(kw2xrf_params)
|
||||
extern void auto_init_event_thread(void);
|
||||
static kw2xrf_t kw2xrf_dev[KW2XRF_NUM];
|
||||
static bhp_event_t kw2xrf_bhp[KW2XRF_NUM];
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_MRF24J40
|
||||
#include "mrf24j40.h"
|
||||
#include "mrf24j40_params.h"
|
||||
#define MRF24J40_NUM ARRAY_SIZE(mrf24j40_params)
|
||||
static mrf24j40_t mrf24j40_dev[MRF24J40_NUM];
|
||||
static bhp_event_t mrf24j40_bhp[MRF24J40_NUM];
|
||||
#endif
|
||||
|
||||
void ieee802154_hal_test_init_devs(ieee802154_dev_cb_t cb, void *opaque)
|
||||
{
|
||||
if (IS_USED(MODULE_EVENT_THREAD)) {
|
||||
auto_init_event_thread();
|
||||
}
|
||||
|
||||
/* Call the init function of the device (this should be handled by
|
||||
* `auto_init`) */
|
||||
ieee802154_dev_t *radio = NULL;
|
||||
@ -78,7 +90,6 @@ void ieee802154_hal_test_init_devs(ieee802154_dev_cb_t cb, void *opaque)
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_KW2XRF
|
||||
auto_init_event_thread();
|
||||
if ((radio = cb(IEEE802154_DEV_TYPE_KW2XRF, opaque)) ){
|
||||
for (unsigned i = 0; i < KW2XRF_NUM; i++) {
|
||||
const kw2xrf_params_t *p = &kw2xrf_params[i];
|
||||
@ -96,4 +107,15 @@ void ieee802154_hal_test_init_devs(ieee802154_dev_cb_t cb, void *opaque)
|
||||
socket_zep_setup(&_socket_zeps[0], &socket_zep_params[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_MRF24J40
|
||||
if ((radio = cb(IEEE802154_DEV_TYPE_MRF24J40, opaque)) ){
|
||||
for (unsigned i = 0; i < MRF24J40_NUM; i++) {
|
||||
const mrf24j40_params_t *p = &mrf24j40_params[i];
|
||||
bhp_event_init(&mrf24j40_bhp[i], EVENT_PRIO_HIGHEST, &mrf24j40_radio_irq_handler, radio);
|
||||
mrf24j40_init(&mrf24j40_dev[i], p, radio, bhp_event_isr_cb, &mrf24j40_bhp[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -265,6 +265,9 @@ static ieee802154_dev_t *_reg_callback(ieee802154_dev_type_t type, void *opaque)
|
||||
case IEEE802154_DEV_TYPE_KW2XRF:
|
||||
printf("kw2xrf");
|
||||
break;
|
||||
case IEEE802154_DEV_TYPE_MRF24J40:
|
||||
printf("mrf24j40");
|
||||
break;
|
||||
}
|
||||
|
||||
puts(".");
|
||||
|
Loading…
Reference in New Issue
Block a user