1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/auto_init: add support for periph_temperature

This commit is contained in:
Alexandre Abadie 2019-01-13 15:04:09 +01:00
parent a142286d8d
commit 891580aba7
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
4 changed files with 64 additions and 0 deletions

View File

@ -602,6 +602,10 @@ ifneq (,$(filter saul,$(USEMODULE)))
USEMODULE += phydat
endif
ifneq (,$(filter saul_nrf_temperature,$(USEMODULE)))
FEATURES_REQUIRED += periph_temperature
endif
ifneq (,$(filter phydat,$(USEMODULE)))
USEMODULE += fmt
endif

View File

@ -62,6 +62,7 @@ PSEUDOMODULES += riotboot_%
PSEUDOMODULES += saul_adc
PSEUDOMODULES += saul_default
PSEUDOMODULES += saul_gpio
PSEUDOMODULES += saul_nrf_temperature
PSEUDOMODULES += schedstatistics
PSEUDOMODULES += sock
PSEUDOMODULES += sock_ip

View File

@ -326,6 +326,10 @@ void auto_init(void)
extern void auto_init_gpio(void);
auto_init_gpio();
#endif
#ifdef MODULE_SAUL_NRF_TEMPERATURE
extern void auto_init_nrf_temperature(void);
auto_init_nrf_temperature();
#endif
#ifdef MODULE_AD7746
extern void auto_init_ad7746(void);
auto_init_ad7746();

View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2019 Inria
*
* 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 sys_auto_init_saul
* @{
*
* @file
* @brief Auto initialization of internal temperature sensor directly mapped to SAUL reg
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/
#ifdef MODULE_SAUL_NRF_TEMPERATURE
#include "cpu.h"
#include "log.h"
#include "saul_reg.h"
#include "saul/periph.h"
/**
* @brief Memory for the registry entries
*/
static saul_reg_t saul_reg_entry;
/**
* @brief Reference the driver struct
*/
extern saul_driver_t nrf_temperature_saul_driver;
/**
* @brief Reference the information for saul registry
*/
extern saul_reg_info_t nrf_temperature_saul_info;
void auto_init_nrf_temperature(void)
{
saul_reg_entry.dev = NULL;
saul_reg_entry.name = nrf_temperature_saul_info.name;
saul_reg_entry.driver = &nrf_temperature_saul_driver;
/* add to registry */
saul_reg_add(&(saul_reg_entry));
}
#else
typedef int dont_be_pedantic;
#endif /* MODULE_SAUL_NRF_TEMPERATURE */