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

tests: add cc2420 driver test

This commit is contained in:
MrKevinWeiss 2022-03-22 10:09:53 +01:00
parent e78a129ba4
commit f1d6b25c62
No known key found for this signature in database
GPG Key ID: 4B69974722CBEEAE
5 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,13 @@
INCLUDES += -I$(APPDIR)
BOARD ?= z1
include ../Makefile.tests_common
USEMODULE += test_utils_netdev_ieee802154_minimal
# select the driver to test
USEMODULE += cc2420
CFLAGS += -DEVENT_THREAD_STACKSIZE_DEFAULT=1024
include $(RIOTBASE)/Makefile.include

View File

@ -0,0 +1,11 @@
BOARD_INSUFFICIENT_MEMORY := \
arduino-duemilanove \
arduino-leonardo \
arduino-nano \
arduino-uno \
atmega328p-xplained-mini \
atmega328p \
nucleo-l011k4 \
samd10-xmini \
stm32f030f4-demo \
#

View File

@ -0,0 +1,19 @@
# About
This is a manual test application for the CC2420 radio driver.
For running this test, you need to connect/configure the following pins of your
radio device:
- SPI MISO
- SPI MOSI
- SPI CLK
- CS (chip select)
- FIFO
- FIFOP
- CCA
- SFD
- VREFEN
- RESET
# Usage
For testing the radio driver you can use the ifconfig and txtsnd shell commands
that are included in this application.

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2022 HAW Hamburg
*
* 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.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Device-specific test header file CC2420 IEEE 802.15.4 device driver
*
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
*/
#ifndef INIT_DEV_H
#define INIT_DEV_H
#include "cc2420_params.h"
#include "kernel_defines.h"
#ifdef __cplusplus
extern "C" {
#endif
#define CC2420_NUM ARRAY_SIZE(cc2420_params)
#define NETDEV_IEEE802154_MINIMAL_NUMOF CC2420_NUM
#ifdef __cplusplus
}
#endif
#endif /* INIT_DEV_H */
/** @} */

View File

@ -0,0 +1,69 @@
/*
* Copyright (C) 2022 HAW Hamburg
*
* 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.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Test application for CC2420 IEEE 802.15.4 device driver
*
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
*
* @}
*/
#include <stdio.h>
#include "cc2420.h"
#include "init_dev.h"
#include "shell.h"
#include "test_utils/netdev_ieee802154_minimal.h"
static cc2420_t cc2420[CC2420_NUM];
int netdev_ieee802154_minimal_init_devs(netdev_event_cb_t cb) {
puts("Initializing CC2420 devices");
for (unsigned i = 0; i < CC2420_NUM; i++) {
printf("%d out of %d\n", i + 1, CC2420_NUM);
netdev_t *netdev = &cc2420[i].netdev.netdev;
/* setup the specific driver */
cc2420_setup(&cc2420[i], &cc2420_params[i], i);
/* set the application-provided callback */
netdev->event_callback = cb;
/* initialize the device driver */
int res = netdev->driver->init(netdev);
if (res) {
return res;
}
}
return 0;
}
int main(void)
{
puts("Test application for CC2420 IEEE 802.15.4 device driver");
int res = netdev_ieee802154_minimal_init();
if (res) {
puts("Error initializing devices");
return 1;
}
/* start the shell */
puts("Initialization successful - starting the shell now");
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;
}