1
0
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:
Bas Stottelaar 2020-11-18 01:33:47 +01:00
parent 431e6efdf6
commit e3b15a4cc4
2 changed files with 62 additions and 0 deletions

View 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));
}

View File

@ -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();