mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/saul: add auto init for efm32_coretemp
This commit is contained in:
parent
431e6efdf6
commit
e3b15a4cc4
58
drivers/saul/init_devs/auto_init_efm32_coretemp.c
Normal file
58
drivers/saul/init_devs/auto_init_efm32_coretemp.c
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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 sys_auto_init_saul
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Auto initialization of EFM32 core temperature driver
|
||||
*
|
||||
* @author Bas Stottelaar <basstottelaar@gmail.com>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "saul_reg.h"
|
||||
#include "saul/periph.h"
|
||||
#include "coretemp.h"
|
||||
|
||||
/**
|
||||
* @brief Memory for the SAUL registry entry
|
||||
*/
|
||||
static saul_reg_t saul_reg_entry;
|
||||
|
||||
/**
|
||||
* @brief Reference the driver struct
|
||||
*/
|
||||
extern saul_driver_t efm32_coretemp_saul_driver;
|
||||
|
||||
/**
|
||||
* @brief Reference the information for saul registry
|
||||
*/
|
||||
extern saul_reg_info_t efm32_coretemp_saul_info;
|
||||
|
||||
void auto_init_efm32_coretemp(void)
|
||||
{
|
||||
LOG_DEBUG("[auto_init_saul] initializing EFM32 coretemp\n");
|
||||
|
||||
/* initialize driver */
|
||||
if (coretemp_init() != 0) {
|
||||
LOG_ERROR("[auto_init_saul] error initializing EFM32 coretemp\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* add to registry */
|
||||
saul_reg_entry.dev = NULL;
|
||||
saul_reg_entry.name = efm32_coretemp_saul_info.name;
|
||||
saul_reg_entry.driver = &efm32_coretemp_saul_driver;
|
||||
|
||||
saul_reg_add(&(saul_reg_entry));
|
||||
}
|
@ -95,6 +95,10 @@ void saul_init_devs(void)
|
||||
extern void auto_init_ds75lx(void);
|
||||
auto_init_ds75lx();
|
||||
}
|
||||
if (IS_USED(MODULE_EFM32_CORETEMP)) {
|
||||
extern void auto_init_efm32_coretemp(void);
|
||||
auto_init_efm32_coretemp();
|
||||
}
|
||||
if (IS_USED(MODULE_FXOS8700)) {
|
||||
extern void auto_init_fxos8700(void);
|
||||
auto_init_fxos8700();
|
||||
|
Loading…
Reference in New Issue
Block a user