drivers/sensors: Add driver for the Bosch BMG160 3 axis gyroscop.
This commit is contained in:
parent
0044910e33
commit
221fcfd8f1
@ -18,6 +18,13 @@ config BH1750FVI
|
||||
---help---
|
||||
Enable driver support for the Rohm BH1750FVI light sensor.
|
||||
|
||||
config BMG160
|
||||
bool "Bosch BMG160 Gyroscope Sensor support"
|
||||
default n
|
||||
select SPI
|
||||
---help---
|
||||
Enable driver support for the Bosch BMG160 gyroscope sensor.
|
||||
|
||||
config BMP180
|
||||
bool "Bosch BMP180 Barometer Sensor support"
|
||||
default n
|
||||
|
@ -73,6 +73,10 @@ ifeq ($(CONFIG_BH1750FVI),y)
|
||||
CSRCS += bh1750fvi.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BMG160),y)
|
||||
CSRCS += bmg160.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BMP180),y)
|
||||
CSRCS += bmp180.c
|
||||
endif
|
||||
|
594
drivers/sensors/bmg160.c
Normal file
594
drivers/sensors/bmg160.c
Normal file
@ -0,0 +1,594 @@
|
||||
/****************************************************************************
|
||||
* drivers/sensors/bmg160.c
|
||||
* Character driver for the BMG160 3-Axis gyroscope.
|
||||
*
|
||||
* Copyright (C) 2016 DS-Automotion GmbH. All rights reserved.
|
||||
* Author: Alexander Entinger <a.entinger@ds-automotion.com>
|
||||
* Thomas Ilk
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <string.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/sensors/bmg160.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_BMG160)
|
||||
|
||||
/****************************************************************************
|
||||
* Private
|
||||
****************************************************************************/
|
||||
|
||||
struct bmg160_sensor_data_s
|
||||
{
|
||||
int16_t x_gyr; /* Measurement result for x axis */
|
||||
int16_t y_gyr; /* Measurement result for y axis */
|
||||
int16_t z_gyr; /* Measurement result for z axis */
|
||||
};
|
||||
|
||||
struct bmg160_dev_s
|
||||
{
|
||||
FAR struct bmg160_dev_s *flink; /* Supports a singly linked list of
|
||||
* drivers */
|
||||
FAR struct spi_dev_s *spi; /* Pointer to the SPI instance */
|
||||
FAR struct bmg160_config_s *config; /* Pointer to the configuration of the
|
||||
* BMG160 sensor */
|
||||
sem_t datasem; /* Manages exclusive access to this
|
||||
* structure */
|
||||
struct bmg160_sensor_data_s data; /* The data as measured by the sensor */
|
||||
struct work_s work; /* The work queue is responsible for
|
||||
* retrieving the data from the sensor
|
||||
* after the arrival of new data was
|
||||
* signalled in an interrupt */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void bmg160_read_register(FAR struct bmg160_dev_s *dev,
|
||||
uint8_t const reg_addr, uint8_t * reg_data);
|
||||
static void bmg160_write_register(FAR struct bmg160_dev_s *dev,
|
||||
uint8_t const reg_addr,
|
||||
uint8_t const reg_data);
|
||||
static void bmg160_reset(FAR struct bmg160_dev_s *dev);
|
||||
static void bmg160_read_measurement_data(FAR struct bmg160_dev_s *dev);
|
||||
static void bmg160_read_gyroscope_data(FAR struct bmg160_dev_s *dev,
|
||||
uint16_t * x_gyr, uint16_t * y_gyr,
|
||||
uint16_t * z_gyr);
|
||||
static int bmg160_interrupt_handler(int irq, FAR void *context);
|
||||
static void bmg160_worker(FAR void *arg);
|
||||
|
||||
static int bmg160_open(FAR struct file *filep);
|
||||
static int bmg160_close(FAR struct file *filep);
|
||||
static ssize_t bmg160_read(FAR struct file *, FAR char *, size_t);
|
||||
static ssize_t bmg160_write(FAR struct file *filep, FAR const char *buffer,
|
||||
size_t buflen);
|
||||
static int bmg160_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const struct file_operations g_bmg160_fops =
|
||||
{
|
||||
bmg160_open,
|
||||
bmg160_close,
|
||||
bmg160_read,
|
||||
bmg160_write,
|
||||
NULL,
|
||||
bmg160_ioctl
|
||||
#ifndef CONFIG_DISABLE_POLL
|
||||
, NULL
|
||||
#endif
|
||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||
, NULL
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Single linked list to store instances of drivers */
|
||||
|
||||
static struct bmg160_dev_s *g_bmg160_list = NULL;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_read_register
|
||||
****************************************************************************/
|
||||
|
||||
static void bmg160_read_register(FAR struct bmg160_dev_s *dev,
|
||||
uint8_t const reg_addr, uint8_t * reg_data)
|
||||
{
|
||||
/* Lock the SPI bus so that only one device can access it at the same time */
|
||||
|
||||
SPI_LOCK(dev->spi, true);
|
||||
|
||||
/* Set CS to low which selects the BMG160 */
|
||||
|
||||
SPI_SELECT(dev->spi, dev->config->spi_devid, true);
|
||||
|
||||
/* Transmit the register address from where we want to read - the MSB needs
|
||||
* to be set to indicate the read indication.
|
||||
*/
|
||||
|
||||
SPI_SEND(dev->spi, reg_addr | 0x80);
|
||||
|
||||
/* Write an idle byte while receiving the required data */
|
||||
|
||||
*reg_data = (uint8_t) (SPI_SEND(dev->spi, 0));
|
||||
|
||||
/* Set CS to high which deselects the BMG160 */
|
||||
|
||||
SPI_SELECT(dev->spi, dev->config->spi_devid, false);
|
||||
|
||||
/* Unlock the SPI bus */
|
||||
|
||||
SPI_LOCK(dev->spi, false);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_write_register
|
||||
****************************************************************************/
|
||||
|
||||
static void bmg160_write_register(FAR struct bmg160_dev_s *dev,
|
||||
uint8_t const reg_addr,
|
||||
uint8_t const reg_data)
|
||||
{
|
||||
/* Lock the SPI bus so that only one device can access it at the same time */
|
||||
|
||||
SPI_LOCK(dev->spi, true);
|
||||
|
||||
/* Set CS to low which selects the BMG160 */
|
||||
|
||||
SPI_SELECT(dev->spi, dev->config->spi_devid, true);
|
||||
|
||||
/* Transmit the register address from where we want to read */
|
||||
|
||||
SPI_SEND(dev->spi, reg_addr);
|
||||
|
||||
/* Transmit the content which should be written in the register */
|
||||
|
||||
SPI_SEND(dev->spi, reg_data);
|
||||
|
||||
/* Set CS to high which deselects the BMG160 */
|
||||
|
||||
SPI_SELECT(dev->spi, dev->config->spi_devid, false);
|
||||
|
||||
/* Unlock the SPI bus */
|
||||
|
||||
SPI_LOCK(dev->spi, false);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_reset
|
||||
****************************************************************************/
|
||||
|
||||
static void bmg160_reset(FAR struct bmg160_dev_s *dev)
|
||||
{
|
||||
bmg160_write_register(dev, BMG160_BGW_SOFTRESET_REG, 0xB6);
|
||||
|
||||
up_mdelay(100);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_read_measurement_data
|
||||
****************************************************************************/
|
||||
|
||||
static void bmg160_read_measurement_data(FAR struct bmg160_dev_s *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Read Gyroscope */
|
||||
|
||||
uint16_t x_gyr = 0, y_gyr = 0, z_gyr = 0;
|
||||
|
||||
bmg160_read_gyroscope_data(dev, &x_gyr, &y_gyr, &z_gyr);
|
||||
|
||||
/* Aquire the semaphore before the data is copied */
|
||||
|
||||
ret = sem_wait(&dev->datasem);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Could not aquire dev->datasem: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Copy retrieve data to internal data structure */
|
||||
|
||||
dev->data.x_gyr = (int16_t) (x_gyr);
|
||||
dev->data.y_gyr = (int16_t) (y_gyr);
|
||||
dev->data.z_gyr = (int16_t) (z_gyr);
|
||||
|
||||
/* Give back the semaphore */
|
||||
|
||||
sem_post(&dev->datasem);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_read_gyroscope_data
|
||||
****************************************************************************/
|
||||
|
||||
static void bmg160_read_gyroscope_data(FAR struct bmg160_dev_s *dev,
|
||||
uint16_t * x_gyr, uint16_t * y_gyr,
|
||||
uint16_t * z_gyr)
|
||||
{
|
||||
/* Lock the SPI bus so that only one device can access it at the same time */
|
||||
|
||||
SPI_LOCK(dev->spi, true);
|
||||
|
||||
/* Set CS to low which selects the BMG160 */
|
||||
|
||||
SPI_SELECT(dev->spi, dev->config->spi_devid, true);
|
||||
|
||||
/* Transmit the register address from where we want to start reading. 0x80
|
||||
* -> MSB is set -> Read Indication.
|
||||
*/
|
||||
|
||||
SPI_SEND(dev->spi, (BMG160_RATE_X_LSB_REG | 0x80));
|
||||
|
||||
/* RX */
|
||||
|
||||
*x_gyr = ((uint16_t) (SPI_SEND(dev->spi, 0)) << 0); /* LSB */
|
||||
*x_gyr |= ((uint16_t) (SPI_SEND(dev->spi, 0)) << 8); /* MSB */
|
||||
|
||||
*y_gyr = ((uint16_t) (SPI_SEND(dev->spi, 0)) << 0); /* LSB */
|
||||
*y_gyr |= ((uint16_t) (SPI_SEND(dev->spi, 0)) << 8); /* MSB */
|
||||
|
||||
*z_gyr = ((uint16_t) (SPI_SEND(dev->spi, 0)) << 0); /* LSB */
|
||||
*z_gyr |= ((uint16_t) (SPI_SEND(dev->spi, 0)) << 8); /* MSB */
|
||||
|
||||
/* Set CS to high which deselects the BMG160 */
|
||||
|
||||
SPI_SELECT(dev->spi, dev->config->spi_devid, false);
|
||||
|
||||
/* Unlock the SPI bus */
|
||||
|
||||
SPI_LOCK(dev->spi, false);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_interrupt_handler
|
||||
****************************************************************************/
|
||||
|
||||
static int bmg160_interrupt_handler(int irq, FAR void *context)
|
||||
{
|
||||
/* This function should be called upon a rising edge on the BMG160 new data
|
||||
* interrupt pin since it signals that new data has been measured.
|
||||
*/
|
||||
|
||||
FAR struct bmg160_dev_s *priv = 0;
|
||||
int ret;
|
||||
|
||||
/* Find out which BMG160 device caused the interrupt */
|
||||
|
||||
for (priv = g_bmg160_list; priv && priv->config->irq != irq;
|
||||
priv = priv->flink);
|
||||
DEBUGASSERT(priv != NULL);
|
||||
|
||||
/* Task the worker with retrieving the latest sensor data. We should not do
|
||||
* this in a interrupt since it might take too long. Also we cannot lock the
|
||||
* SPI bus from within an interrupt.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(priv->work.worker == NULL);
|
||||
ret = work_queue(HPWORK, &priv->work, bmg160_worker, priv, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Failed to queue work: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_worker
|
||||
****************************************************************************/
|
||||
|
||||
static void bmg160_worker(FAR void *arg)
|
||||
{
|
||||
FAR struct bmg160_dev_s *priv = (FAR struct bmg160_dev_s *)(arg);
|
||||
DEBUGASSERT(priv != NULL);
|
||||
|
||||
/* Read out the latest sensor data */
|
||||
|
||||
bmg160_read_measurement_data(priv);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_open
|
||||
****************************************************************************/
|
||||
|
||||
static int bmg160_open(FAR struct file *filep)
|
||||
{
|
||||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct bmg160_dev_s *priv = inode->i_private;
|
||||
#ifdef CONFIG_DEBUG_SENSORS_INFO
|
||||
uint8_t reg_content;
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
|
||||
/* Perform a reset */
|
||||
|
||||
bmg160_reset(priv);
|
||||
|
||||
/* Configure the sensor for our needs */
|
||||
|
||||
/* Enable - the full scale range FS = +/- 250 °/s */
|
||||
|
||||
bmg160_write_register(priv,
|
||||
BMG160_RANGE_REG,
|
||||
BMG160_RANGE_REG_FIX_VAL_bm | BMG160_RANGE_REG_FSR_1_bm |
|
||||
BMG160_RANGE_REG_FSR_0_bm);
|
||||
|
||||
/* Enable - the fastest data output rate ODR = 2000 Hz -> BW = 230 Hz */
|
||||
|
||||
bmg160_write_register(priv, BMG160_BW_REG, BMG160_BW_REG_ODR_0_bm);
|
||||
|
||||
/* Enable - new data interrupt 1 */
|
||||
|
||||
bmg160_write_register(priv,
|
||||
BMG160_INT_EN_0_REG, BMG160_INT_EN_0_REG_DATA_EN_bm);
|
||||
|
||||
/* Enable - active high level interrupt 1 - push-pull interrupt */
|
||||
|
||||
bmg160_write_register(priv,
|
||||
BMG160_INT_EN_1_REG, BMG160_INT_EN_1_REG_INT1_LVL_bm);
|
||||
|
||||
/* Enable - map new data interrupt to INT1 */
|
||||
|
||||
bmg160_write_register(priv,
|
||||
BMG160_INT_MAP_1_REG,
|
||||
BMG160_INT_MAP_1_REG_INT1_DATA_bm);
|
||||
|
||||
/* Read measurement data to ensure DRDY is low */
|
||||
|
||||
bmg160_read_measurement_data(priv);
|
||||
|
||||
#ifdef CONFIG_DEBUG_SENSORS_INFO
|
||||
/* Read back the content of all control registers for debug purposes */
|
||||
|
||||
reg_content = 0;
|
||||
bmg160_read_register(priv, BMG160_RANGE_REG, ®_content);
|
||||
sninfo("BMG160_RANGE_REG = %04x\n", reg_content);
|
||||
|
||||
bmg160_read_register(priv, BMG160_BW_REG, ®_content);
|
||||
sninfo("BMG160_BW_REG = %04x\n", reg_content);
|
||||
|
||||
bmg160_read_register(priv, BMG160_INT_EN_0_REG, ®_content);
|
||||
sninfo("BMG160_INT_EN_0_REG = %04x\n", reg_content);
|
||||
|
||||
bmg160_read_register(priv, BMG160_INT_EN_1_REG, ®_content);
|
||||
sninfo("BMG160_INT_EN_1_REG = %04x\n", reg_content);
|
||||
|
||||
bmg160_read_register(priv, BMG160_INT_MAP_1_REG, ®_content);
|
||||
sninfo("BMG160_INT_MAP_1_REG = %04x\n", reg_content);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_close
|
||||
****************************************************************************/
|
||||
|
||||
static int bmg160_close(FAR struct file *filep)
|
||||
{
|
||||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct bmg160_dev_s *priv = inode->i_private;
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
|
||||
/* Perform a reset */
|
||||
|
||||
bmg160_reset(priv);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_read
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t bmg160_read(FAR struct file *filep, FAR char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct bmg160_dev_s *priv = inode->i_private;
|
||||
FAR struct bmg160_sensor_data_s *data;
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
|
||||
/* Check if enough memory was provided for the read call */
|
||||
|
||||
if (buflen < sizeof(FAR struct bmg160_sensor_data_s))
|
||||
{
|
||||
snerr("ERROR: Not enough memory for reading out a sensor data sample\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
/* Aquire the semaphore before the data is copied */
|
||||
|
||||
ret = sem_wait(&priv->datasem);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Could not aquire priv->datasem: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Copy the sensor data into the buffer */
|
||||
|
||||
data = (FAR struct bmg160_sensor_data_s *)buffer;
|
||||
memset(data, 0, sizeof(FAR struct bmg160_sensor_data_s));
|
||||
|
||||
data->x_gyr = priv->data.x_gyr;
|
||||
data->y_gyr = priv->data.y_gyr;
|
||||
data->z_gyr = priv->data.z_gyr;
|
||||
|
||||
/* Give back the semaphore */
|
||||
|
||||
sem_post(&priv->datasem);
|
||||
|
||||
return sizeof(FAR struct bmg160_sensor_data_s);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_write
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t bmg160_write(FAR struct file *filep, FAR const char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_ioctl
|
||||
****************************************************************************/
|
||||
|
||||
static int bmg160_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
/* Command was not recognized */
|
||||
|
||||
default:
|
||||
snerr("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bmg160_register
|
||||
*
|
||||
* Description:
|
||||
* Register the BMG160 character device as 'devpath'
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the driver to register. E.g., "/dev/gyr0"
|
||||
* spi - An instance of the SPI interface to use to communicate with
|
||||
* BMG160
|
||||
* config - configuration for the BMG160 driver. For details see
|
||||
* description above.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int bmg160_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
FAR struct bmg160_config_s *config)
|
||||
{
|
||||
FAR struct bmg160_dev_s *priv;
|
||||
int ret;
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
DEBUGASSERT(spi != NULL);
|
||||
DEBUGASSERT(config != NULL);
|
||||
|
||||
/* Initialize the BMG160 device structure */
|
||||
|
||||
priv = (FAR struct bmg160_dev_s *)kmm_malloc(sizeof(struct bmg160_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
priv->spi = spi;
|
||||
priv->config = config;
|
||||
priv->work.worker = NULL;
|
||||
|
||||
/* Initialize sensor data access semaphore */
|
||||
|
||||
sem_init(&priv->datasem, 0, 1);
|
||||
|
||||
/* Setup SPI frequency and mode */
|
||||
|
||||
SPI_SETFREQUENCY(spi, BMG160_SPI_FREQUENCY);
|
||||
SPI_SETMODE(spi, BMG160_SPI_MODE);
|
||||
|
||||
/* Attach the interrupt handler */
|
||||
|
||||
ret = priv->config->attach(priv->config, &bmg160_interrupt_handler);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Failed to attach interrupt\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Register the character driver */
|
||||
|
||||
ret = register_driver(devpath, &g_bmg160_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
sem_destroy(&priv->datasem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Since we support multiple BMG160 devices, we will need to add this new
|
||||
* instance to a list of device instances so that it can be found by the
|
||||
* interrupt handler based on the received IRQ number. */
|
||||
|
||||
priv->flink = g_bmg160_list;
|
||||
g_bmg160_list = priv;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SPI && CONFIG_BMG160 */
|
@ -230,9 +230,9 @@ static void lis3dsh_read_measurement_data(FAR struct lis3dsh_dev_s *dev)
|
||||
/* Aquire the semaphore before the data is copied */
|
||||
|
||||
ret = sem_wait(&dev->datasem);
|
||||
if (ret != OK)
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Could not aquire dev->datasem: %d\n", ret);
|
||||
snerr("ERROR: Could not aquire dev->datasem: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ static int lis3dsh_interrupt_handler(int irq, FAR void *context)
|
||||
ret = work_queue(HPWORK, &priv->work, lis3dsh_worker, priv, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to queue work: %d\n", ret);
|
||||
snerr("ERROR: Failed to queue work: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -382,24 +382,26 @@ static int lis3dsh_open(FAR struct file *filep)
|
||||
|
||||
/* Read back the content of all control registers for debug purposes */
|
||||
|
||||
#ifdef CONFIG_DEBUG_SENSORS_INFO
|
||||
{
|
||||
uint8_t reg_content = 0;
|
||||
|
||||
lis3dsh_read_register(priv, LIS3DSH_CTRL_REG_1, ®_content);
|
||||
snerr("LIS3DSH_CTRL_REG_1 = %04x\n", reg_content);
|
||||
sninfo("LIS3DSH_CTRL_REG_1 = %04x\n", reg_content);
|
||||
lis3dsh_read_register(priv, LIS3DSH_CTRL_REG_2, ®_content);
|
||||
snerr("LIS3DSH_CTRL_REG_2 = %04x\n", reg_content);
|
||||
sninfo("LIS3DSH_CTRL_REG_2 = %04x\n", reg_content);
|
||||
lis3dsh_read_register(priv, LIS3DSH_CTRL_REG_3, ®_content);
|
||||
snerr("LIS3DSH_CTRL_REG_3 = %04x\n", reg_content);
|
||||
sninfo("LIS3DSH_CTRL_REG_3 = %04x\n", reg_content);
|
||||
lis3dsh_read_register(priv, LIS3DSH_CTRL_REG_4, ®_content);
|
||||
snerr("LIS3DSH_CTRL_REG_4 = %04x\n", reg_content);
|
||||
sninfo("LIS3DSH_CTRL_REG_4 = %04x\n", reg_content);
|
||||
lis3dsh_read_register(priv, LIS3DSH_CTRL_REG_5, ®_content);
|
||||
snerr("LIS3DSH_CTRL_REG_5 = %04x\n", reg_content);
|
||||
sninfo("LIS3DSH_CTRL_REG_5 = %04x\n", reg_content);
|
||||
lis3dsh_read_register(priv, LIS3DSH_CTRL_REG_6, ®_content);
|
||||
snerr("LIS3DSH_CTRL_REG_6 = %04x\n", reg_content);
|
||||
sninfo("LIS3DSH_CTRL_REG_6 = %04x\n", reg_content);
|
||||
lis3dsh_read_register(priv, LIS3DSH_STATUS_REG, ®_content);
|
||||
snerr("STATUS_REG = %04x\n", reg_content);
|
||||
sninfo("STATUS_REG = %04x\n", reg_content);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -440,17 +442,17 @@ static ssize_t lis3dsh_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
if (buflen < sizeof(FAR struct lis3dsh_sensor_data_s))
|
||||
{
|
||||
snerr("Not enough memory for reading out a sensor data sample\n");
|
||||
snerr("ERROR: Not enough memory for reading out a sensor data sample\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
/* Aquire the semaphore before the data is copied */
|
||||
|
||||
ret = sem_wait(&priv->datasem);
|
||||
if (ret != OK)
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Could not aquire priv->datasem: %d\n", ret);
|
||||
return ERROR;
|
||||
snerr("ERROR: Could not aquire priv->datasem: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Copy the sensor data into the buffer */
|
||||
@ -492,7 +494,7 @@ static int lis3dsh_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
/* Command was not recognized */
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d\n", cmd);
|
||||
snerr("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -537,7 +539,7 @@ int lis3dsh_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
priv = (FAR struct lis3dsh_dev_s *)kmm_malloc(sizeof(struct lis3dsh_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -558,10 +560,10 @@ int lis3dsh_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
ret = register_driver(devpath, &g_lis3dsh_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
sem_destroy(&priv->datasem);
|
||||
return -ENODEV;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Since we support multiple LIS3DSH devices, we will need to add this new
|
||||
@ -577,8 +579,8 @@ int lis3dsh_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
ret = priv->config->attach(priv->config, &lis3dsh_interrupt_handler);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to attach interrupt\n");
|
||||
return -ENODEV;
|
||||
snerr("ERROR: Failed to attach interrupt: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
@ -237,7 +237,7 @@ static void lis3mdl_read_measurement_data(FAR struct lis3mdl_dev_s *dev)
|
||||
int ret = sem_wait(&dev->datasem);
|
||||
if (ret != OK)
|
||||
{
|
||||
snerr("Could not aquire dev->datasem: %d\n", ret);
|
||||
snerr("ERROR: Could not aquire dev->datasem: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ static int lis3mdl_interrupt_handler(int irq, FAR void *context)
|
||||
ret = work_queue(HPWORK, &priv->work, lis3mdl_worker, priv, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to queue work: %d\n", ret);
|
||||
snerr("ERROR: Failed to queue work: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
@ -440,11 +440,11 @@ static int lis3mdl_open(FAR struct file *filep)
|
||||
reg_addr++)
|
||||
{
|
||||
lis3mdl_read_register(priv, reg_addr, ®_content);
|
||||
snerr("R#%04x = %04x\n", reg_addr, reg_content);
|
||||
sninfo("R#%04x = %04x\n", reg_addr, reg_content);
|
||||
}
|
||||
|
||||
lis3mdl_read_register(priv, LIS3MDL_STATUS_REG, ®_content);
|
||||
snerr("STATUS_REG = %04x\n", reg_content);
|
||||
sninfo("STATUS_REG = %04x\n", reg_content);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -485,7 +485,7 @@ static ssize_t lis3mdl_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
if (buflen < sizeof(FAR struct lis3mdl_sensor_data_s))
|
||||
{
|
||||
snerr("Not enough memory for reading out a sensor data sample\n");
|
||||
snerr("ERROR: Not enough memory for reading out a sensor data sample\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ static ssize_t lis3mdl_read(FAR struct file *filep, FAR char *buffer,
|
||||
ret = sem_wait(&priv->datasem);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Could not aquire priv->datasem: %d\n", ret);
|
||||
snerr("ERROR: Could not aquire priv->datasem: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ static int lis3mdl_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
/* Command was not recognized */
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d\n", cmd);
|
||||
snerr("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -584,7 +584,7 @@ int lis3mdl_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
priv = (FAR struct lis3mdl_dev_s *)kmm_malloc(sizeof(struct lis3mdl_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ int lis3mdl_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
ret = priv->config->attach(priv->config, &lis3mdl_interrupt_handler);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to attach interrupt\n");
|
||||
snerr("ERROR: Failed to attach interrupt\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ int lis3mdl_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
ret = register_driver(devpath, &g_lis3mdl_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
sem_destroy(&priv->datasem);
|
||||
return -ENODEV;
|
||||
|
@ -218,7 +218,7 @@ static void mlx90393_read_measurement_data(FAR struct mlx90393_dev_s *dev)
|
||||
ret = sem_wait(&dev->datasem);
|
||||
if (ret != OK)
|
||||
{
|
||||
sndbg("Could not aquire dev->datasem: %d\n", ret);
|
||||
snerr("ERROR: Could not aquire dev->datasem: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -381,7 +381,7 @@ static int mlx90393_interrupt_handler(int irq, FAR void *context)
|
||||
ret = work_queue(HPWORK, &priv->work, mlx90393_worker, priv, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
sndbg("Failed to queue work: %d\n", ret);
|
||||
snerr("ERROR: Failed to queue work: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
@ -421,14 +421,16 @@ static int mlx90393_open(FAR struct file *filep)
|
||||
|
||||
mlx90393_reset(priv);
|
||||
|
||||
#ifdef CONFIG_DEBUG_SENSORS_INFO
|
||||
/* Read the content of ALL registers for debug purposes */
|
||||
|
||||
for (reg_addr = 0; reg_addr < NUM_REGS; reg_addr++)
|
||||
{
|
||||
uint16_t reg_content = 0;
|
||||
mlx90393_read_register(priv, reg_addr, ®_content);
|
||||
sndbg("R%d = %x\n", reg_addr, reg_content);
|
||||
sninfo("R%d = %x\n", reg_addr, reg_content);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Start the burst mode */
|
||||
|
||||
@ -473,7 +475,7 @@ static ssize_t mlx90393_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
if (buflen < sizeof(FAR struct mlx90393_sensor_data_s))
|
||||
{
|
||||
sndbg("Not enough memory for reading out a sensor data sample\n");
|
||||
snerr("ERROR: Not enough memory for reading out a sensor data sample\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
@ -484,7 +486,7 @@ static ssize_t mlx90393_read(FAR struct file *filep, FAR char *buffer,
|
||||
ret = sem_wait(&priv->datasem);
|
||||
if (ret < 0)
|
||||
{
|
||||
sndbg("Could not aquire priv->datasem: %d\n", ret);
|
||||
snerr("ERROR: Could not aquire priv->datasem: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -526,7 +528,7 @@ static int mlx90393_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
/* Command was not recognized */
|
||||
|
||||
default:
|
||||
sndbg("Unrecognized cmd: %d\n", cmd);
|
||||
snerr("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -571,7 +573,7 @@ int mlx90393_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
priv = (FAR struct mlx90393_dev_s *)kmm_malloc(sizeof(struct mlx90393_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
dbg("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -593,7 +595,7 @@ int mlx90393_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
ret = priv->config->attach(priv->config, &mlx90393_interrupt_handler);
|
||||
if (ret < 0)
|
||||
{
|
||||
dbg("Failed to attach interrupt\n");
|
||||
snerr("ERROR: Failed to attach interrupt\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -602,7 +604,7 @@ int mlx90393_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
ret = register_driver(devpath, &g_mlx90393_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
dbg("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
sem_destroy(&priv->datasem);
|
||||
return -ENODEV;
|
||||
|
440
include/nuttx/sensors/bmg160.h
Normal file
440
include/nuttx/sensors/bmg160.h
Normal file
@ -0,0 +1,440 @@
|
||||
/********************************************************************************************
|
||||
* include/nuttx/sensors/bmg160.h
|
||||
*
|
||||
* Copyright (C) 2016 DS-Automotion GmbH. All rights reserved.
|
||||
* Author: Alexander Entinger <a.entinger@ds-automotion.com>
|
||||
* Thomas Ilk
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_BMG160_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_BMG160_H
|
||||
|
||||
/********************************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************************/
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_BMG160)
|
||||
|
||||
/********************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
********************************************************************************************/
|
||||
|
||||
/* BMG160 Register Definitions **************************************************************/
|
||||
|
||||
/* Chip ID */
|
||||
|
||||
#define BMG160_CHIP_ID_REG (0x00) /* Contains the chip identification code */
|
||||
|
||||
/* Data Register */
|
||||
|
||||
#define BMG160_RATE_X_LSB_REG (0x02)
|
||||
#define BMG160_RATE_X_MSB_REG (0x03)
|
||||
#define BMG160_RATE_Y_LSB_REG (0x04)
|
||||
#define BMG160_RATE_Y_MSB_REG (0x05)
|
||||
#define BMG160_RATE_Z_LSB_REG (0x06)
|
||||
#define BMG160_RATE_Z_MSB_REG (0x07)
|
||||
#define BMG160_TEMP_REG (0x08)
|
||||
|
||||
/* Status Register */
|
||||
|
||||
#define BMG160_INT_STATUS_0_REG (0x09) /* Contains interrupt status bits */
|
||||
#define BMG160_INT_STATUS_1_REG (0x0A) /* Contains interrupt status bits */
|
||||
#define BMG160_INT_STATUS_2_REG (0x0B) /* Contains any motion interrupt status bits */
|
||||
#define BMG160_INT_STATUS_3_REG (0x0C) /* Contains high rate interrupt status bits */
|
||||
#define BMG160_FIFO_STATUS_REG (0x0E) /* Contains FIFO status flags */
|
||||
|
||||
/* Control Register */
|
||||
|
||||
#define BMG160_RANGE_REG (0x0F) /* enables to select FSR */
|
||||
#define BMG160_BW_REG (0x10) /* enables to select ODR */
|
||||
#define BMG160_LPM1_REG (0x11) /* Selection of the main power modes */
|
||||
#define BMG160_LPM2_REG (0x12) /* Configuration settings for fast power-up and external trigger */
|
||||
#define BMG160_RATE_HBW_REG (0x13) /* Angular rate data acquisition and data output format */
|
||||
#define BMG160_BGW_SOFTRESET_REG (0x14) /* Controls user triggered reset of the sensor */
|
||||
|
||||
/* Interrupt Status Register */
|
||||
|
||||
#define BMG160_INT_EN_0_REG (0x15) /* Controls which interrupts are enabled */
|
||||
#define BMG160_INT_EN_1_REG (0x16) /* Contains interrupt pin configuration */
|
||||
#define BMG160_INT_MAP_0_REG (0x17) /* Controls which interrupt signals are mapped to the INT1 pin */
|
||||
#define BMG160_INT_MAP_1_REG (0x18) /* Controls which interrupt signals are mapped to the INT1 pin and INT2 pin */
|
||||
#define BMG160_INT_MAP_2_REG (0x19) /* Controls which interrupt signals are mapped to the INT2 pin */
|
||||
#define BMG160_INT_ZERO_REG (0x1A) /* Contains the data source definition of those interrupts with selectable data source */
|
||||
#define BMG160_INT_ONE_REG (0x1B) /* Contains the data source definition of fast offset compensation and the any motion threshold */
|
||||
#define BMG160_INT_TWO_REG (0x1C) /* Contains the any motion configuration for x-, y- and z-axis */
|
||||
#define BMG160_INT_FOUR_REG (0x1E)
|
||||
#define BMG160_INT_RST_LATCH_REG (0x21) /* Contains the interrupt reset bit and the interrupt mode selection */
|
||||
|
||||
/* Interrupt High Rate Configuration Register */
|
||||
|
||||
#define BMG160_HIGH_TH_X_REG (0x22) /* Contains the high rate threshold and high rate hysteresis setting for the x-axis */
|
||||
#define BMG160_HIGH_DUR_X_REG (0x23) /* Contains high rate duration setting for the x-axis */
|
||||
#define BMG160_HIGH_TH_Y_REG (0x24) /* Contains the high rate threshold and high rate hysteresis setting for the y-axis */
|
||||
#define BMG160_HIGH_DUR_Y_REG (0x25) /* Contains high rate duration setting for the y-axis */
|
||||
#define BMG160_HIGH_TH_Z_REG (0x26) /* Contains the high rate threshold and high rate hysteresis setting for the z-axis */
|
||||
#define BMG160_HIGH_DUR_Z_REG (0x27) /* Contains high rate duration setting for the z-axis */
|
||||
|
||||
/* Offset Register */
|
||||
|
||||
#define BMG160_SOC_REG (0x31) /* Contains the slow offset cancellation setting */
|
||||
#define BMG160_FOC_REG (0x32) /* Contains the fast offset cancellation setting */
|
||||
|
||||
/* NVM Control Register */
|
||||
|
||||
#define BMG160_TRIM_NVM_CTRL_REG (0x33) /* Contains the control settings for the few-time programmable non-volatile memory (NVM) */
|
||||
|
||||
/* Digital Interface Register */
|
||||
|
||||
#define BMG160_BGW_SPI3_WDT_REG (0x34) /* Contains settings for the digital interfaces */
|
||||
|
||||
/* Offset Configuration Register */
|
||||
|
||||
#define BMG160_OFC1_REG (0x36) /* Contains offset compensation values */
|
||||
#define BMG160_OFC2_REG (0x37) /* Contains offset compensation values for X-channel */
|
||||
#define BMG160_OFC3_REG (0x38) /* Contains offset compensation values for Y-channel */
|
||||
#define BMG160_OFC4_REG (0x39) /* Contains offset compensation values for Z-channel */
|
||||
#define BMG160_TRIM_GP0_REG (0x3A) /* Contains general purpose data register with NVM back-up */
|
||||
#define BMG160_TRIM_GP1_REG (0x3B) /* Contains general purpose data register with NVM back-up */
|
||||
|
||||
/* Self-test Register */
|
||||
|
||||
#define BMG160_BIST_REG (0x3C) /* Contains Built in Self-Test possibilities */
|
||||
|
||||
/* FIFO Register */
|
||||
|
||||
#define BMG160_FIFO_CONFIG_0_REG (0x3D) /* Contains the FIFO watermark level */
|
||||
#define BMG160_FIFO_CONFIG_1_REG (0x3E) /* Contains FIFO configuration settings. The FIFO buffer memory is cleared and
|
||||
* the FIFO-full flag cleared when writing to FIFO_CONFIG_1 register */
|
||||
#define BMG160_FIFO_DATA_REG (0x3F) /* FIFO data readout register */
|
||||
|
||||
/* Control Register Definitions *************************************************************/
|
||||
|
||||
/* BMG160 RANGE_REG Definitions */
|
||||
|
||||
#define BMG160_RANGE_REG_FSR_0_bm (1 << 0) /* Full scale selection bit 0 */
|
||||
#define BMG160_RANGE_REG_FSR_1_bm (1 << 1) /* Full scale selection bit 1 */
|
||||
#define BMG160_RANGE_REG_FSR_2_bm (1 << 2) /* Full scale selection bit 2 */
|
||||
#define BMG160_RANGE_REG_FIX_VAL_bm (1 << 7) /* write 1 to 7th bit of Range Register */
|
||||
|
||||
/* BMG160 BW_REG Definitions */
|
||||
|
||||
#define BMG160_BW_REG_ODR_0_bm (1 << 0) /* Output data rate selection bit 0 */
|
||||
#define BMG160_BW_REG_ODR_1_bm (1 << 1) /* Output data rate selection bit 1 */
|
||||
#define BMG160_BW_REG_ODR_2_bm (1 << 2) /* Output data rate selection bit 2 */
|
||||
|
||||
/* BMG160 LPM1_REG Definitions */
|
||||
|
||||
#define BMG160_LPM1_REG_SP_bm (1 << 7) /* active suspend mode */
|
||||
#define BMG160_LPM1_REG_D_SP_bm (1 << 5) /* active deep suspend mode */
|
||||
#define BMG160_LPM1_REG_S_DUR_0_bm (1 << 1) /* Sleep duration selection bit 0 */
|
||||
#define BMG160_LPM1_REG_S_DUR_1_bm (1 << 2) /* Sleep duration selection bit 1 */
|
||||
#define BMG160_LPM1_REG_S_DUR_2_bm (1 << 3) /* Sleep duration selection bit 2 */
|
||||
|
||||
/* BMG160 LPM1_REG Definitions */
|
||||
|
||||
#define BMG160_LPM1_REG_AS_DUR_0_bm (1 << 0) /* Auto sleep duration selection bit 0 */
|
||||
#define BMG160_LPM1_REG_AS_DUR_1_bm (1 << 1) /* Auto sleep duration selection bit 1 */
|
||||
#define BMG160_LPM1_REG_AS_DUR_2_bm (1 << 2) /* Auto sleep duration selection bit 2 */
|
||||
#define BMG160_LPM1_REG_E_T_S_0_bm (1 << 4) /* External trigger selection bit 0 */
|
||||
#define BMG160_LPM1_REG_E_T_S_1_bm (1 << 5) /* External trigger selection bit 1 */
|
||||
#define BMG160_LPM1_REG_P_S_M_bm (1 << 6) /* Power save mode */
|
||||
#define BMG160_LPM1_REG_FAST_PU_bm (1 << 7) /* Fast power-up mode */
|
||||
|
||||
/* BMG160 RATE_HBW_REG Definitions */
|
||||
|
||||
#define BMG160_HBW_REG_DATA_HIGH_BW_bm (1 << 7) /* Enable unfiltered data reading */
|
||||
#define BMG160_HBW_REG_SHW_DIS_bm (1 << 6) /* Disable shadow mechanism for the rate data output register */
|
||||
|
||||
|
||||
/* Interrupt Status Register Definitions ****************************************************/
|
||||
|
||||
/* BMG160 INT_EN_0_REG Definitions */
|
||||
|
||||
#define BMG160_INT_EN_0_REG_DATA_EN_bm (1 << 7) /* Enable new data interrupt */
|
||||
#define BMG160_INT_EN_0_REG_FIFO_EN_bm (1 << 6) /* Enable FIFO interrupt */
|
||||
#define BMG160_INT_EN_0_REG_AUTO_OFF_EN_bm (1 << 1) /* Enable auto-offset compensation */
|
||||
|
||||
/* BMG160 INT_EN_1_REG Definitions */
|
||||
|
||||
#define BMG160_INT_EN_1_REG_INT2_OD_bm (1 << 3) /* Select open drive for INT2 */
|
||||
#define BMG160_INT_EN_1_REG_INT2_LVL_bm (1 << 2) /* Select active level '1' for INT2 */
|
||||
#define BMG160_INT_EN_1_REG_INT1_OD_bm (1 << 1) /* Select open drive for INT1 */
|
||||
#define BMG160_INT_EN_1_REG_INT1_LVL_bm (1 << 0) /* Select active level '1' for INT1 */
|
||||
|
||||
/* BMG160 INT_MAP_0_REG Definitions */
|
||||
|
||||
#define BMG160_INT_MAP_0_REG_INT1_HIGH_bm (1 << 3) /* Map high rate interrupt to INT1 pin */
|
||||
#define BMG160_INT_MAP_0_REG_INT1_ANY_bm (1 << 1) /* Map Any-Motion to INT1 pin */
|
||||
|
||||
/* BMG160 INT_MAP_1_REG Definitions */
|
||||
|
||||
#define BMG160_INT_MAP_1_REG_INT2_DATA_bm (1 << 7) /* Map new data interrupt to INT2 pin */
|
||||
#define BMG160_INT_MAP_1_REG_INT2_Fast_OFF_bm (1 << 6) /* Map Fast Offset interrupt to INT2 pin */
|
||||
#define BMG160_INT_MAP_1_REG_INT2_FIFO_bm (1 << 5) /* Map FIFO interrupt to INT2 pin */
|
||||
#define BMG160_INT_MAP_1_REG_INT2_AUTO_OFF_bm (1 << 4) /* Map Auto Offset tap interrupt to INT2 pin */
|
||||
#define BMG160_INT_MAP_1_REG_INT1_AUTO_OFF_bm (1 << 3) /* Map Auto Offset tap interrupt to INT1 pin */
|
||||
#define BMG160_INT_MAP_1_REG_INT1_FIFO_bm (1 << 2) /* Map FIFO interrupt to INT1 pin */
|
||||
#define BMG160_INT_MAP_1_REG_INT1_Fast_OFF_bm (1 << 1) /* Map Fast Offset interrupt to INT1 pin */
|
||||
#define BMG160_INT_MAP_1_REG_INT1_DATA_bm (1 << 0) /* Map new data interrupt to INT1 pin */
|
||||
|
||||
/* BMG160 INT_MAP_2_REG Definitions */
|
||||
|
||||
#define BMG160_INT_MAP_0_REG_INT2_HIGH_bm (1 << 3) /* Map high rate interrupt to INT2 pin */
|
||||
#define BMG160_INT_MAP_0_REG_INT2_ANY_bm (1 << 1) /* Map Any-Motion to INT2 pin */
|
||||
|
||||
/* BMG160 INT_ZERO_REG Definitions */
|
||||
|
||||
#define BMG160_INT_ZERO_REG_SLOW_OFF_UN_bm (1 << 5) /* Selects unfiltered data for slow offset compensation */
|
||||
#define BMG160_INT_ZERO_REG_HIGH_UN_D_bm (1 << 3) /* Selects unfiltered data for high rate interrupt */
|
||||
#define BMG160_INT_ZERO_REG_ANY_UN_D_bm (1 << 1) /* Selects unfiltered data for any motion interrupt
|
||||
|
||||
/* BMG160 INT_ONE_REG Definitions */
|
||||
|
||||
#define BMG160_INT_ONE_REG_FAST_OFF_UN_bm (1 << 7) /* Selects unfiltered data for fast offset compensation */
|
||||
|
||||
/* BMG160 INT_TWO_REG Definitions */
|
||||
|
||||
#define BMG160_INT_TWO_REG_ANY_EN_Z_bm (1 << 2) /* Enables any motion interrupt for z-axis */
|
||||
#define BMG160_INT_TWO_REG_ANY_EN_Y_bm (1 << 1) /* Enables any motion interrupt for y-axis */
|
||||
#define BMG160_INT_TWO_REG_ANY_EN_X_bm (1 << 0) /* Enables any motion interrupt for x-axis */
|
||||
|
||||
/* BMG160 INT_FOUR_REG Definitions */
|
||||
|
||||
#define BMG160_INT_FOUR_REG_FIFO_WM_EN_bm (1 << 2) /* Enables fifo water mark level interrupt
|
||||
|
||||
/* BMG160 INT_RST_LATCH_REG Definitions */
|
||||
|
||||
#define BMG160_INT_RST_LATCH_REG_RST_INT_bm (1 << 7) /* Clears any latched interrupts */
|
||||
#define BMG160_INT_RST_LATCH_REG_OFF_RST_bm (1 << 6) /* Resets the Offset value calculated with Fast-, Slow- and AutoOffset */
|
||||
#define BMG160_INT_RST_LATCH_REG_LATCH_STAT_bm (1 << 4)
|
||||
#define BMG160_INT_RST_LATCH_REG_LATCH_INT_3_bm (1 << 3) /* Latch mode selection bit 3 */
|
||||
#define BMG160_INT_RST_LATCH_REG_LATCH_INT_2_bm (1 << 2) /* Latch mode selection bit 2 */
|
||||
#define BMG160_INT_RST_LATCH_REG_LATCH_INT_1_bm (1 << 1) /* Latch mode selection bit 1 */
|
||||
#define BMG160_INT_RST_LATCH_REG_LATCH_INT_0_bm (1 << 0) /* Latch mode selection bit 0 */
|
||||
|
||||
/* Interupt High Rate Configuration Register Definitions ************************************/
|
||||
|
||||
/* BMG160 HIGH_TH_X_REG Definitions */
|
||||
|
||||
#define BMG160_HIGH_TH_X_REG_HY_X_1_bm (1 << 7)
|
||||
#define BMG160_HIGH_TH_X_REG_HY_X_0_bm (1 << 6)
|
||||
#define BMG160_HIGH_TH_X_REG_TH_X_4_bm (1 << 5)
|
||||
#define BMG160_HIGH_TH_X_REG_TH_X_3_bm (1 << 4)
|
||||
#define BMG160_HIGH_TH_X_REG_TH_X_2_bm (1 << 3)
|
||||
#define BMG160_HIGH_TH_X_REG_TH_X_1_bm (1 << 2)
|
||||
#define BMG160_HIGH_TH_X_REG_TH_X_0_bm (1 << 1)
|
||||
#define BMG160_HIGH_TH_X_REG_EN_X_1_bm (1 << 0) /* Enables high rate interrupt for x-axis */
|
||||
|
||||
/* BMG160 HIGH_DUR_X_REG Definitions */
|
||||
|
||||
#define BMG160_HIGH_DUR_X_REG_7_bm (1 << 7)
|
||||
#define BMG160_HIGH_DUR_X_REG_6_bm (1 << 6)
|
||||
#define BMG160_HIGH_DUR_X_REG_5_bm (1 << 5)
|
||||
#define BMG160_HIGH_DUR_X_REG_4_bm (1 << 4)
|
||||
#define BMG160_HIGH_DUR_X_REG_3_bm (1 << 3)
|
||||
#define BMG160_HIGH_DUR_X_REG_2_bm (1 << 2)
|
||||
#define BMG160_HIGH_DUR_X_REG_1_bm (1 << 1)
|
||||
#define BMG160_HIGH_DUR_X_REG_0_bm (1 << 0)
|
||||
|
||||
/* BMG160 HIGH_TH_Y_REG Definitions */
|
||||
|
||||
#define BMG160_HIGH_TH_Y_REG_HY_Y_1_bm (1 << 7)
|
||||
#define BMG160_HIGH_TH_Y_REG_HY_Y_0_bm (1 << 6)
|
||||
#define BMG160_HIGH_TH_Y_REG_TH_Y_4_bm (1 << 5)
|
||||
#define BMG160_HIGH_TH_Y_REG_TH_Y_3_bm (1 << 4)
|
||||
#define BMG160_HIGH_TH_Y_REG_TH_Y_2_bm (1 << 3)
|
||||
#define BMG160_HIGH_TH_Y_REG_TH_Y_1_bm (1 << 2)
|
||||
#define BMG160_HIGH_TH_Y_REG_TH_Y_0_bm (1 << 1)
|
||||
#define BMG160_HIGH_TH_Y_REG_EN_Y_1_bm (1 << 0) /* Enables high rate interrupt for Y-axis */
|
||||
|
||||
/* BMG160 HIGH_DUR_Y_REG Definitions */
|
||||
|
||||
#define BMG160_HIGH_DUR_Y_REG_7_bm (1 << 7)
|
||||
#define BMG160_HIGH_DUR_Y_REG_6_bm (1 << 6)
|
||||
#define BMG160_HIGH_DUR_Y_REG_5_bm (1 << 5)
|
||||
#define BMG160_HIGH_DUR_Y_REG_4_bm (1 << 4)
|
||||
#define BMG160_HIGH_DUR_Y_REG_3_bm (1 << 3)
|
||||
#define BMG160_HIGH_DUR_Y_REG_2_bm (1 << 2)
|
||||
#define BMG160_HIGH_DUR_Y_REG_1_bm (1 << 1)
|
||||
#define BMG160_HIGH_DUR_Y_REG_0_bm (1 << 0)
|
||||
|
||||
/* BMG160 HIGH_TH_Z_REG Definitions */
|
||||
|
||||
#define BMG160_HIGH_TH_Z_REG_HY_Z_1_bm (1 << 7)
|
||||
#define BMG160_HIGH_TH_Z_REG_HY_Z_0_bm (1 << 6)
|
||||
#define BMG160_HIGH_TH_Z_REG_TH_Z_4_bm (1 << 5)
|
||||
#define BMG160_HIGH_TH_Z_REG_TH_Z_3_bm (1 << 4)
|
||||
#define BMG160_HIGH_TH_Z_REG_TH_Z_2_bm (1 << 3)
|
||||
#define BMG160_HIGH_TH_Z_REG_TH_Z_1_bm (1 << 2)
|
||||
#define BMG160_HIGH_TH_Z_REG_TH_Z_0_bm (1 << 1)
|
||||
#define BMG160_HIGH_TH_Z_REG_EN_Z_1_bm (1 << 0) /* Enables high rate interrupt for Z-axis */
|
||||
|
||||
/* BMG160 HIGH_DUR_Z_REG Definitions */
|
||||
|
||||
#define BMG160_HIGH_DUR_Z_REG_7_bm (1 << 7)
|
||||
#define BMG160_HIGH_DUR_Z_REG_6_bm (1 << 6)
|
||||
#define BMG160_HIGH_DUR_Z_REG_5_bm (1 << 5)
|
||||
#define BMG160_HIGH_DUR_Z_REG_4_bm (1 << 4)
|
||||
#define BMG160_HIGH_DUR_Z_REG_3_bm (1 << 3)
|
||||
#define BMG160_HIGH_DUR_Z_REG_2_bm (1 << 2)
|
||||
#define BMG160_HIGH_DUR_Z_REG_1_bm (1 << 1)
|
||||
#define BMG160_HIGH_DUR_Z_REG_0_bm (1 << 0)
|
||||
|
||||
/* Offset Register Definitions **************************************************************/
|
||||
|
||||
/* BMG160 SOC_REG */
|
||||
|
||||
#define BMG160_SOC_REG_SLOW_OFF_EN_Z_bm (1 << 2) /* Enables slow offset compensation for z-axis */
|
||||
#define BMG160_SOC_REG_SLOW_OFF_EN_Y_bm (1 << 1) /* Enables slow offset compensation for y-axis */
|
||||
#define BMG160_SOC_REG_SLOW_OFF_EN_X_bm (1 << 0) /* Enables slow offset compensation for x-axis */
|
||||
|
||||
/* BMG160 FOC_REG */
|
||||
|
||||
#define BMG160_FOC_REG_FAST_OFF_EN_bm (1 << 2) /* Triggers the fast offset compensation for the enabled axes */
|
||||
#define BMG160_FOC_REG_FAST_OFF_EN_Z_bm (1 << 2) /* Enables fast offset compensation for z-axis */
|
||||
#define BMG160_FOC_REG_FAST_OFF_EN_Y_bm (1 << 1) /* Enables fast offset compensation for y-axis */
|
||||
#define BMG160_FOC_REG_FAST_OFF_EN_X_bm (1 << 0) /* Enables fast offset compensation for x-axis */
|
||||
|
||||
/* NVM Control Register Definitions *********************************************************/
|
||||
|
||||
/* BMG160 TRIM_NVM_CTRL_REG */
|
||||
|
||||
#define BMG160_TRIM_NVM_CTRL_REG_NVM_LOAD_bm (1 << 3) /* Triggers an update of all config registers form NVM,
|
||||
* the NVM_RDY flag must be '1' prior to triggering the update */
|
||||
#define BMG160_TRIM_NVM_CTRL_REG_NVM_PROG_TRIG_bm (1 << 1) /* Triggers an NVM write operation; (see page 59, data sheet)
|
||||
* the NVM_RDY flag must be '1' prior to triggering the update */
|
||||
#define BMG160_TRIM_NVM_CTRL_REG_NVM_PROG_MODE_bm (1 << 0) /* unlock NVM write operation */
|
||||
|
||||
/* Digital Interface Register Definitions ***************************************************/
|
||||
|
||||
/* BMG160 BGW_SPI3_WDT_REG */
|
||||
|
||||
#define BMG160_BGW_SPI3_WDT_REG_I2C_WDT_EN_bm (1 << 2) /* Enables watchdog at the SDA pin if I2C mode is selected */
|
||||
#define BMG160_BGW_SPI3_WDT_REG_I2C_WDT_SEL_bm (1 << 1) /* Select an I2C watchdog timer period of 50ms */
|
||||
#define BMG160_BGW_SPI3_WDT_REG_SPI3_bm (1 << 0) /* Enable 3-wire SPI mode */
|
||||
|
||||
/* Offset Configuration Register Definitions ************************************************/
|
||||
|
||||
/* FIFO Register Definitions ****************************************************************/
|
||||
|
||||
/* BMG160 FIFO_CONFIG_0_REG */
|
||||
|
||||
#define BMG160_FIFO_CONFIG_0_REG_TAG_bm (1 << 7) /* Enables FIFO tag (interrupt) */
|
||||
|
||||
/* BMG160 FIFO_CONFIG_1_REG */
|
||||
|
||||
#define BMG160_FIFO_CONFIG_1_REG_MODE_1_bm (1 << 7) /* FIFO mode selection bit 1 */
|
||||
#define BMG160_FIFO_CONFIG_1_REG_MODE_0_bm (1 << 6) /* FIFO mode selection bit 0 */
|
||||
#define BMG160_FIFO_CONFIG_1_REG_DATA_SEL_1_bm (1 << 1) /* FIFO data selection bit 1 */
|
||||
#define BMG160_FIFO_CONFIG_1_REG_DATA_SEL_0_bm (1 << 0) /* FIFO data selection bit 0 */
|
||||
|
||||
/* SPI BUS PARAMETERS ***********************************************************************/
|
||||
|
||||
#define BMG160_SPI_FREQUENCY (4000000) /* 4 MHz */
|
||||
#define BMG160_SPI_MODE (SPIDEV_MODE3) /* Device uses SPI Mode 3: CPOL=1, CPHA=1 */
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Types
|
||||
********************************************************************************************/
|
||||
|
||||
/* A reference to a structure of this type must be passed to the BMG160
|
||||
* driver. This structure provides information about the configuration
|
||||
* of the sensor and provides some board-specific hooks.
|
||||
*
|
||||
* Memory for this structure is provided by the caller. It is not copied
|
||||
* by the driver and is presumed to persist while the driver is active.
|
||||
*/
|
||||
|
||||
struct bmg160_config_s
|
||||
{
|
||||
/* Since multiple BMG160 can be connected to the same SPI bus we need
|
||||
* to use multiple spi device ids which are employed by NuttX to select/
|
||||
* deselect the desired BMG160 chip via their chip select inputs.
|
||||
*/
|
||||
|
||||
int spi_devid;
|
||||
|
||||
/* The IRQ number must be provided for each BMG160 device so that
|
||||
* their interrupts can be distinguished.
|
||||
*/
|
||||
|
||||
int irq;
|
||||
|
||||
/* Attach the BMG160 interrupt handler to the GPIO interrupt of the
|
||||
* concrete BMG160 instance.
|
||||
*/
|
||||
|
||||
int (*attach)(FAR struct bmg160_config_s *, xcpt_t);
|
||||
};
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/********************************************************************************************
|
||||
* Name: bmg160_register
|
||||
*
|
||||
* Description:
|
||||
* Register the BMG160 character device as 'devpath'
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the driver to register. E.g., "/dev/gyr0"
|
||||
* spi - An instance of the SPI interface to use to communicate with BMG160
|
||||
* config - configuration for the BMG160 driver. For details see description above.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
int bmg160_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
FAR struct bmg160_config_s *config);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SPI && CONFIG_BMG160 */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_BMG160_H */
|
@ -34,8 +34,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NUTTX_INCLUDE_NUTTX_SENSORS_LIS3DSH_H_
|
||||
#define NUTTX_INCLUDE_NUTTX_SENSORS_LIS3DSH_H_
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_LIS3DSH_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_LIS3DSH_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@ -274,4 +274,4 @@ int lis3dsh_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SPI && CONFIG_LIS3DSH */
|
||||
#endif /* NUTTX_INCLUDE_NUTTX_SENSORS_LIS3DSH_H_ */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_LIS3DSH_H */
|
||||
|
@ -33,8 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NUTTX_INCLUDE_NUTTX_SENSORS_LIS3MDL_H_
|
||||
#define NUTTX_INCLUDE_NUTTX_SENSORS_LIS3MDL_H_
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_LIS3MDL_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_LIS3MDL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@ -177,4 +177,4 @@ int lis3mdl_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SPI && CONFIG_LIS3MDL */
|
||||
#endif /* NUTTX_INCLUDE_NUTTX_SENSORS_LIS3MDL_H_ */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_LIS3MDL_H */
|
||||
|
@ -33,8 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NUTTX_INCLUDE_NUTTX_SENSORS_MLX90393_H_
|
||||
#define NUTTX_INCLUDE_NUTTX_SENSORS_MLX90393_H_
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_MLX90393_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_MLX90393_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@ -150,4 +150,4 @@ int mlx90393_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
|
||||
#endif /* CONFIG_SPI && CONFIG_MLX90393 */
|
||||
|
||||
#endif /* NUTTX_INCLUDE_NUTTX_SENSORS_MLX90393_H_ */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_MLX90393_H */
|
||||
|
Loading…
Reference in New Issue
Block a user