tests/cpu_efm32_drivers: add test application

This commit is contained in:
Bas Stottelaar 2020-01-08 00:45:10 +01:00
parent e1b356e884
commit d66d8ae998
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,17 @@
BOARD ?= sltb001a
include ../Makefile.tests_common
BOARD_WHITELIST := ikea-tradfri \
slstk3401a \
slstk3402a \
sltb001a \
slwstk6000b-slwrb4150a \
slwstk6000b-slwrb4162a \
slwstk6220a \
stk3200 \
stk3600 \
stk3700
USEMODULE += efm32_coretemp
include $(RIOTBASE)/Makefile.include

View File

@ -0,0 +1,11 @@
# EFM32 CPU Drivers
## Introduction
The EFM32 CPU has additional drivers that can be used. This test application
ensure that these drivers work.
Current tests includes:
* EFM32 core temperature driver
## Expected result
The test application compiles for EFM32-based boards.

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2020 Bas Stottelaar <basstottelaar@gmail.com>
*
* 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 EFM32 specific drivers
*
* @author Bas Stottelaar <basstottelaar@gmail.com>
*
* @}
*/
#include <stdio.h>
#include "coretemp.h"
static void test_coretemp(void)
{
puts("Testing internal EFM32 temperature driver.");
/* initialize the sensor */
int result = coretemp_init();
if (result == 0) {
puts("Driver initialization OK.");
}
else {
printf("Driver initialization failed: %d.", result);
return;
}
/* read temperature */
int16_t temperature = coretemp_read();
printf("Temperature: %d.%02d C\n", temperature / 100, temperature % 100);
}
int main(void)
{
test_coretemp();
return 0;
}