1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/drivers/lis2dh12/include/lis2dh12_params.h
2019-10-02 11:16:39 +02:00

96 lines
2.2 KiB
C

/*
* Copyright (C) 2018 Freie Universität Berlin
*
* 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 drivers_lis2dh12
*
* @{
* @file
* @brief Default configuration for LIS2DH12 devices
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef LIS2DH12_PARAMS_H
#define LIS2DH12_PARAMS_H
#include "board.h"
#include "lis2dh12.h"
#include "saul_reg.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Set default configuration parameters for LIS2DH12 devices
* @{
*/
#ifdef MODULE_LIS2DH12_SPI /* default configuration for SPI mode */
#ifndef LIS2DH12_PARAM_SPI
#define LIS2DH12_PARAM_SPI SPI_DEV(0)
#endif
#ifndef LIS2DH12_PARAM_CS
#define LIS2DH12_PARAM_CS GPIO_PIN(0, 0)
#endif
#define LIS2DH12_PARAMS_BUSCFG .spi = LIS2DH12_PARAM_SPI, \
.cs = LIS2DH12_PARAM_CS
#else /* default configuration for I2C mode */
#ifndef LIS2DH12_PARAM_I2C
#define LIS2DH12_PARAM_I2C I2C_DEV(0)
#endif
#ifndef LIS2DH12_PARAM_ADDR
#define LIS2DH12_PARAM_ADDR LIS2DH12_ADDR_DEFAULT
#endif
#define LIS2DH12_PARAMS_BUSCFG .i2c = LIS2DH12_PARAM_I2C, \
.addr = LIS2DH12_PARAM_ADDR
#endif
#ifndef LIS2DH12_PARAM_SCALE
#define LIS2DH12_PARAM_SCALE LIS2DH12_SCALE_2G
#endif
#ifndef LIS2DH12_PARAM_RATE
#define LIS2DH12_PARAM_RATE LIS2DH12_RATE_100HZ
#endif
#ifndef LIS2DH12_PARAMS
#define LIS2DH12_PARAMS { LIS2DH12_PARAMS_BUSCFG, \
.scale = LIS2DH12_PARAM_SCALE, \
.rate = LIS2DH12_PARAM_RATE, }
#endif
#ifndef LIS2DH12_SAULINFO
#define LIS2DH12_SAULINFO { .name = "lis2dh12" }
#endif
/**@}*/
/**
* @brief LIS2DH12 configuration
*/
static const lis2dh12_params_t lis2dh12_params[] =
{
LIS2DH12_PARAMS
};
/**
* @brief Additional meta information to keep in the SAUL registry
*/
static const saul_reg_info_t lis2dh12_saul_info[] =
{
LIS2DH12_SAULINFO
};
#ifdef __cplusplus
}
#endif
#endif /* LIS2DH12_PARAMS_H */
/** @} */