summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMaureen Helm <maureen.helm@nxp.com>2016-10-24 23:45:12 -0500
committerAnas Nashif <nashif@linux.intel.com>2016-10-27 14:36:43 +0000
commit3bdc77ee094c0f4f88379dd3159cd10199dc3a61 (patch)
treeb6246d4d64bb07684795e9a9d4f92f7fd96d0eed /drivers
parent884d9961ae5c9206493dad35ffe7e0071f9f3c95 (diff)
sensor: fxos8700: Add accelerometer/magnetometer driver
Adds basic sensor driver support for the NXP FXOS8700 6-axis accelerometer/magnetometer. Currently this driver supports accelerometer-only, magnetometer-only, and hybrid (accelerometer + magnetometer) modes, as well as 2g, 4g, and 8g accelerometer full scale ranges. This driver does not yet support any sensor triggers such as the data ready trigger, or runtime changing of sensor attributes. Datasheet: http://cache.nxp.com/files/sensors/doc/data_sheet/FXOS8700CQ.pdf Origin: Original Jira: ZEP-721 Change-Id: Iff0f751c737196f60d5c5d3448631b57093ece34 Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/sensor/Kconfig2
-rw-r--r--drivers/sensor/Makefile1
-rw-r--r--drivers/sensor/fxos8700/Kconfig103
-rw-r--r--drivers/sensor/fxos8700/Makefile18
-rw-r--r--drivers/sensor/fxos8700/fxos8700.c344
-rw-r--r--drivers/sensor/fxos8700/fxos8700.h101
6 files changed, 569 insertions, 0 deletions
diff --git a/drivers/sensor/Kconfig b/drivers/sensor/Kconfig
index aefec54dc..188434b06 100644
--- a/drivers/sensor/Kconfig
+++ b/drivers/sensor/Kconfig
@@ -64,6 +64,8 @@ source "drivers/sensor/bmi160/Kconfig"
source "drivers/sensor/dht/Kconfig"
+source "drivers/sensor/fxos8700/Kconfig"
+
source "drivers/sensor/hdc1008/Kconfig"
source "drivers/sensor/hmc5883l/Kconfig"
diff --git a/drivers/sensor/Makefile b/drivers/sensor/Makefile
index 083fda00c..4d22bae74 100644
--- a/drivers/sensor/Makefile
+++ b/drivers/sensor/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_BME280) += bme280/
obj-$(CONFIG_BMG160) += bmg160/
obj-$(CONFIG_BMI160) += bmi160/
obj-$(CONFIG_DHT) += dht/
+obj-$(CONFIG_FXOS8700) += fxos8700/
obj-$(CONFIG_HDC1008) += hdc1008/
obj-$(CONFIG_HMC5883L) += hmc5883l/
obj-$(CONFIG_HP206C) += hp206c/
diff --git a/drivers/sensor/fxos8700/Kconfig b/drivers/sensor/fxos8700/Kconfig
new file mode 100644
index 000000000..84a8bef4b
--- /dev/null
+++ b/drivers/sensor/fxos8700/Kconfig
@@ -0,0 +1,103 @@
+# Kconfig - FXOS8700 6-axis accelerometer/magnetometer
+#
+# Copyright (c) 2016 Freescale Semiconductor, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+menuconfig FXOS8700
+ bool "FXOS8700 accelerometer/magnetometer driver"
+ depends on SENSOR && I2C
+ default n
+ help
+ Enable driver for the FXOS8700 accelerometer/magnetometer
+
+config FXOS8700_SYS_LOG_LEVEL
+ int "Log level"
+ depends on SYS_LOG && FXOS8700
+ default 0
+ range 0 4
+ help
+ Sets log level for FXOS8700 driver.
+ Levels are:
+
+ - 0 OFF: do not write
+
+ - 1 ERROR: only write SYS_LOG_ERR
+
+ - 2 WARNING: write SYS_LOG_WRN in addition to previous level
+
+ - 3 INFO: write SYS_LOG_INF in addition to previous levels
+
+ - 4 DEBUG: write SYS_LOG_DBG in addition to previous levels
+
+config FXOS8700_NAME
+ string "Device name"
+ depends on FXOS8700
+ default "FXOS8700"
+
+config FXOS8700_I2C_NAME
+ string "I2C device name"
+ depends on FXOS8700
+ default I2C_0_NAME
+
+config FXOS8700_I2C_ADDRESS
+ hex "I2C address"
+ depends on FXOS8700
+ range 0x1c 0x1f
+ default 0x1d
+ help
+ The I2C slave address can be configured by the SA0 and SA1 input pins.
+ This option should usually be set by the board defconfig.
+
+config FXOS8700_WHOAMI
+ hex "WHOAMI value"
+ depends on FXOS8700
+ range 0x00 0xff
+ default 0xc7
+ help
+ The datasheet defines the value of the WHOAMI register, but some
+ pre-production devices can have a different value. It is unlikely you
+ should need to change this configuration option from the default.
+
+choice
+ prompt "Mode"
+ depends on FXOS8700
+ default FXOS8700_MODE_ACCEL
+
+config FXOS8700_MODE_ACCEL
+ bool "Accelerometer-only mode"
+
+config FXOS8700_MODE_MAGN
+ bool "Magnetometer-only mode"
+
+config FXOS8700_MODE_HYBRID
+ bool "Hybrid (accel+mag) mode"
+
+endchoice
+
+choice
+ prompt "Range"
+ depends on FXOS8700
+ default FXOS8700_RANGE_8G
+
+config FXOS8700_RANGE_8G
+ bool "8g (0.976 mg/LSB)"
+
+config FXOS8700_RANGE_4G
+ bool "4g (0.488 mg/LSB)"
+
+config FXOS8700_RANGE_2G
+ bool "2g (0.244 mg/LSB)"
+
+endchoice
diff --git a/drivers/sensor/fxos8700/Makefile b/drivers/sensor/fxos8700/Makefile
new file mode 100644
index 000000000..b86595698
--- /dev/null
+++ b/drivers/sensor/fxos8700/Makefile
@@ -0,0 +1,18 @@
+# Makefile - FXOS8700 6-axis accelerometer/magnetometer
+#
+# Copyright (c) 2016, Freescale Semiconductor, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+obj-$(CONFIG_FXOS8700) += fxos8700.o
diff --git a/drivers/sensor/fxos8700/fxos8700.c b/drivers/sensor/fxos8700/fxos8700.c
new file mode 100644
index 000000000..99bea741b
--- /dev/null
+++ b/drivers/sensor/fxos8700/fxos8700.c
@@ -0,0 +1,344 @@
+/*
+ * Copyright (c) 2016 Freescale Semiconductor, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fxos8700.h>
+#include <misc/util.h>
+#include <misc/__assert.h>
+
+static int fxos8700_sample_fetch(struct device *dev, enum sensor_channel chan)
+{
+ const struct fxos8700_config *config = dev->config->config_info;
+ struct fxos8700_data *data = dev->driver_data;
+ uint8_t buffer[FXOS8700_MAX_NUM_BYTES];
+ uint8_t num_bytes;
+ int16_t *raw;
+ int ret = 0;
+ int i;
+
+ if (chan != SENSOR_CHAN_ALL) {
+ SYS_LOG_DBG("Unsupported sensor channel");
+ return -ENOTSUP;
+ }
+
+ nano_sem_take(&data->sem, TICKS_UNLIMITED);
+
+ /* Read all the channels in one I2C transaction. The number of bytes to
+ * read and the starting register address depend on the mode
+ * configuration (accel-only, mag-only, or hybrid).
+ */
+ num_bytes = config->num_channels * FXOS8700_BYTES_PER_CHANNEL_NORMAL;
+
+ __ASSERT(num_bytes <= sizeof(buffer), "Too many bytes to read");
+
+ if (i2c_burst_read(data->i2c, config->i2c_address, config->start_addr,
+ buffer, num_bytes)) {
+ SYS_LOG_DBG("Could not fetch sample");
+ ret = -EIO;
+ goto exit;
+ }
+
+ /* Parse the buffer into raw channel data (16-bit integers). To save
+ * RAM, store the data in raw format and wait to convert to the
+ * normalized sensor_value type until later.
+ */
+ __ASSERT(config->start_channel + config->num_channels
+ <= ARRAY_SIZE(data->raw),
+ "Too many channels");
+
+ raw = &data->raw[config->start_channel];
+
+ for (i = 0; i < num_bytes; i += 2) {
+ *raw++ = (buffer[i] << 8) | (buffer[i+1]);
+ }
+
+exit:
+ nano_sem_give(&data->sem);
+
+ return ret;
+}
+
+static void fxos8700_accel_convert(struct sensor_value *val, int16_t raw,
+ enum fxos8700_range range)
+{
+ uint8_t frac_bits;
+ int64_t micro_ms2;
+
+ /* The range encoding is convenient to compute the number of fractional
+ * bits:
+ * - 2g mode (range = 0) has 14 fractional bits
+ * - 4g mode (range = 1) has 13 fractional bits
+ * - 8g mode (range = 2) has 12 fractional bits
+ */
+ frac_bits = 14 - range;
+
+ /* Convert units to micro m/s^2. Intermediate results before the shift
+ * are 40 bits wide.
+ */
+ micro_ms2 = (raw * SENSOR_G) >> frac_bits;
+
+ /* The maximum possible value is 8g, which in units of micro m/s^2
+ * always fits into 32-bits. Cast down to int32_t so we can use a
+ * faster divide.
+ */
+ val->val1 = (int32_t) micro_ms2 / 1000000;
+ val->val2 = (int32_t) micro_ms2 % 1000000;
+ val->type = SENSOR_VALUE_TYPE_INT_PLUS_MICRO;
+}
+
+static void fxos8700_magn_convert(struct sensor_value *val, int16_t raw)
+{
+ int32_t micro_g;
+
+ /* Convert units to micro Gauss. Raw magnetic data always has a
+ * resolution of 0.1 uT/LSB, which is equivalent to 0.001 G/LSB.
+ */
+ micro_g = raw * 1000;
+
+ val->val1 = micro_g / 1000000;
+ val->val2 = micro_g % 1000000;
+ val->type = SENSOR_VALUE_TYPE_INT_PLUS_MICRO;
+}
+
+static int fxos8700_channel_get(struct device *dev, enum sensor_channel chan,
+ struct sensor_value *val)
+{
+ const struct fxos8700_config *config = dev->config->config_info;
+ struct fxos8700_data *data = dev->driver_data;
+ int start_channel;
+ int num_channels;
+ int16_t *raw;
+ int ret;
+ int i;
+
+ nano_sem_take(&data->sem, TICKS_UNLIMITED);
+
+ /* Start with an error return code by default, then clear it if we find
+ * a supported sensor channel.
+ */
+ ret = -ENOTSUP;
+
+ /* If we're in an accelerometer-enabled mode (accel-only or hybrid),
+ * then convert raw accelerometer data to the normalized sensor_value
+ * type.
+ */
+ if (config->mode != FXOS8700_MODE_MAGN) {
+ switch (chan) {
+ case SENSOR_CHAN_ACCEL_X:
+ start_channel = FXOS8700_CHANNEL_ACCEL_X;
+ num_channels = 1;
+ break;
+ case SENSOR_CHAN_ACCEL_Y:
+ start_channel = FXOS8700_CHANNEL_ACCEL_Y;
+ num_channels = 1;
+ break;
+ case SENSOR_CHAN_ACCEL_Z:
+ start_channel = FXOS8700_CHANNEL_ACCEL_Z;
+ num_channels = 1;
+ break;
+ case SENSOR_CHAN_ACCEL_ANY:
+ start_channel = FXOS8700_CHANNEL_ACCEL_X;
+ num_channels = 3;
+ break;
+ default:
+ start_channel = 0;
+ num_channels = 0;
+ break;
+ }
+
+ raw = &data->raw[start_channel];
+ for (i = 0; i < num_channels; i++) {
+ fxos8700_accel_convert(val++, *raw++, config->range);
+ }
+
+ if (num_channels > 0) {
+ ret = 0;
+ }
+ }
+
+ /* If we're in an magnetometer-enabled mode (mag-only or hybrid), then
+ * convert raw magnetometer data to the normalized sensor_value type.
+ */
+ if (config->mode != FXOS8700_MODE_ACCEL) {
+ switch (chan) {
+ case SENSOR_CHAN_MAGN_X:
+ start_channel = FXOS8700_CHANNEL_MAGN_X;
+ num_channels = 1;
+ break;
+ case SENSOR_CHAN_MAGN_Y:
+ start_channel = FXOS8700_CHANNEL_MAGN_Y;
+ num_channels = 1;
+ break;
+ case SENSOR_CHAN_MAGN_Z:
+ start_channel = FXOS8700_CHANNEL_MAGN_Z;
+ num_channels = 1;
+ break;
+ case SENSOR_CHAN_MAGN_ANY:
+ start_channel = FXOS8700_CHANNEL_MAGN_X;
+ num_channels = 3;
+ break;
+ default:
+ start_channel = 0;
+ num_channels = 0;
+ break;
+ }
+
+ raw = &data->raw[start_channel];
+ for (i = 0; i < num_channels; i++) {
+ fxos8700_magn_convert(val++, *raw++);
+ }
+
+ if (num_channels > 0) {
+ ret = 0;
+ }
+ }
+
+ if (ret != 0) {
+ SYS_LOG_DBG("Unsupported sensor channel");
+ }
+
+ nano_sem_give(&data->sem);
+
+ return ret;
+}
+
+static int fxos8700_init(struct device *dev)
+{
+ const struct fxos8700_config *config = dev->config->config_info;
+ struct fxos8700_data *data = dev->driver_data;
+ uint8_t whoami;
+
+ /* Get the I2C device */
+ data->i2c = device_get_binding(config->i2c_name);
+ if (data->i2c == NULL) {
+ SYS_LOG_DBG("Could not find I2C device");
+ return -EINVAL;
+ }
+
+ /* Read the WHOAMI register to make sure we are talking to FXOS8700 and
+ * not some other type of device that happens to have the same I2C
+ * address.
+ */
+ if (i2c_reg_read_byte(data->i2c, config->i2c_address,
+ FXOS8700_REG_WHOAMI, &whoami)) {
+ SYS_LOG_DBG("Could not get WHOAMI value");
+ return -EIO;
+ }
+
+ if (whoami != config->whoami) {
+ SYS_LOG_DBG("WHOAMI value received 0x%x, expected 0x%x",
+ whoami, FXOS8700_REG_WHOAMI);
+ return -EIO;
+ }
+
+ /* Reset the sensor. Upon issuing a software reset command over the I2C
+ * interface, the sensor immediately resets and does not send any
+ * acknowledgment (ACK) of the written byte to the master. Therefore,
+ * do not check the return code of the I2C transaction.
+ */
+ i2c_reg_write_byte(data->i2c, config->i2c_address,
+ FXOS8700_REG_CTRLREG2, FXOS8700_CTRLREG2_RST_MASK);
+
+ /* The sensor requires us to wait 1 ms after a software reset before
+ * attempting further communications.
+ */
+ sys_thread_busy_wait(USEC_PER_MSEC);
+
+ /* Set the mode (accel-only, mag-only, or hybrid) */
+ if (i2c_reg_update_byte(data->i2c, config->i2c_address,
+ FXOS8700_REG_M_CTRLREG1,
+ FXOS8700_M_CTRLREG1_MODE_MASK,
+ config->mode)) {
+ SYS_LOG_DBG("Could not set mode");
+ return -EIO;
+ }
+
+ /* Set hybrid autoincrement so we can read accel and mag channels in
+ * one I2C transaction.
+ */
+ if (i2c_reg_update_byte(data->i2c, config->i2c_address,
+ FXOS8700_REG_M_CTRLREG2,
+ FXOS8700_M_CTRLREG2_AUTOINC_MASK,
+ FXOS8700_M_CTRLREG2_AUTOINC_MASK)) {
+ SYS_LOG_DBG("Could not set hybrid autoincrement");
+ return -EIO;
+ }
+
+ /* Set the full-scale range */
+ if (i2c_reg_update_byte(data->i2c, config->i2c_address,
+ FXOS8700_REG_XYZ_DATA_CFG,
+ FXOS8700_XYZ_DATA_CFG_FS_MASK,
+ config->range)) {
+ SYS_LOG_DBG("Could not set range");
+ return -EIO;
+ }
+
+ /* Set active */
+ if (i2c_reg_update_byte(data->i2c, config->i2c_address,
+ FXOS8700_REG_CTRLREG1,
+ FXOS8700_CTRLREG1_ACTIVE_MASK,
+ FXOS8700_CTRLREG1_ACTIVE_MASK)) {
+ SYS_LOG_DBG("Could not set active");
+ return -EIO;
+ }
+
+ nano_sem_init(&data->sem);
+ nano_sem_give(&data->sem);
+
+ SYS_LOG_DBG("Init complete");
+
+ return 0;
+}
+
+static const struct sensor_driver_api fxos8700_driver_api = {
+ .sample_fetch = fxos8700_sample_fetch,
+ .channel_get = fxos8700_channel_get,
+};
+
+static const struct fxos8700_config fxos8700_config = {
+ .i2c_name = CONFIG_FXOS8700_I2C_NAME,
+ .i2c_address = CONFIG_FXOS8700_I2C_ADDRESS,
+ .whoami = CONFIG_FXOS8700_WHOAMI,
+#ifdef CONFIG_FXOS8700_MODE_ACCEL
+ .mode = FXOS8700_MODE_ACCEL,
+ .start_addr = FXOS8700_REG_OUTXMSB,
+ .start_channel = FXOS8700_CHANNEL_ACCEL_X,
+ .num_channels = FXOS8700_NUM_ACCEL_CHANNELS,
+#elif CONFIG_FXOS8700_MODE_MAGN
+ .mode = FXOS8700_MODE_MAGN,
+ .start_addr = FXOS8700_REG_M_OUTXMSB,
+ .start_channel = FXOS8700_CHANNEL_MAGN_X,
+ .num_channels = FXOS8700_NUM_MAG_CHANNELS,
+#else
+ .mode = FXOS8700_MODE_HYBRID,
+ .start_addr = FXOS8700_REG_OUTXMSB,
+ .start_channel = FXOS8700_CHANNEL_ACCEL_X,
+ .num_channels = FXOS8700_NUM_HYBRID_CHANNELS,
+#endif
+#if CONFIG_FXOS8700_RANGE_8G
+ .range = FXOS8700_RANGE_8G,
+#elif CONFIG_FXOS8700_RANGE_4G
+ .range = FXOS8700_RANGE_4G,
+#else
+ .range = FXOS8700_RANGE_2G,
+#endif
+};
+
+static struct fxos8700_data fxos8700_data;
+
+DEVICE_AND_API_INIT(fxos8700, CONFIG_FXOS8700_NAME, fxos8700_init,
+ &fxos8700_data, &fxos8700_config,
+ SECONDARY, CONFIG_SENSOR_INIT_PRIORITY,
+ &fxos8700_driver_api);
diff --git a/drivers/sensor/fxos8700/fxos8700.h b/drivers/sensor/fxos8700/fxos8700.h
new file mode 100644
index 000000000..0d2414570
--- /dev/null
+++ b/drivers/sensor/fxos8700/fxos8700.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2016 Freescale Semiconductor, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sensor.h>
+#include <i2c.h>
+
+#define SYS_LOG_DOMAIN "FXOS8700"
+#define SYS_LOG_LEVEL CONFIG_FXOS8700_SYS_LOG_LEVEL
+#include <misc/sys_log.h>
+
+#define FXOS8700_REG_STATUS 0x00
+#define FXOS8700_REG_OUTXMSB 0x01
+#define FXOS8700_REG_INT_SOURCE 0x0c
+#define FXOS8700_REG_WHOAMI 0x0d
+#define FXOS8700_REG_XYZ_DATA_CFG 0x0e
+#define FXOS8700_REG_CTRLREG1 0x2a
+#define FXOS8700_REG_CTRLREG2 0x2b
+#define FXOS8700_REG_CTRLREG3 0x2c
+#define FXOS8700_REG_CTRLREG4 0x2d
+#define FXOS8700_REG_CTRLREG5 0x2e
+#define FXOS8700_REG_M_OUTXMSB 0x33
+#define FXOS8700_REG_M_CTRLREG1 0x5b
+#define FXOS8700_REG_M_CTRLREG2 0x5c
+
+#define FXOS8700_XYZ_DATA_CFG_FS_MASK 0x03
+
+#define FXOS8700_CTRLREG1_ACTIVE_MASK 0x01
+#define FXOS8700_CTRLREG1_DR_MASK (7 << 3)
+
+#define FXOS8700_CTRLREG2_RST_MASK 0x40
+
+#define FXOS8700_M_CTRLREG1_MODE_MASK 0x03
+
+#define FXOS8700_M_CTRLREG2_AUTOINC_MASK (1 << 5)
+
+#define FXOS8700_NUM_ACCEL_CHANNELS 3
+#define FXOS8700_NUM_MAG_CHANNELS 3
+#define FXOS8700_NUM_HYBRID_CHANNELS 6
+#define FXOS8700_MAX_NUM_CHANNELS 6
+
+#define FXOS8700_BYTES_PER_CHANNEL_NORMAL 2
+#define FXOS8700_BYTES_PER_CHANNEL_FAST 1
+
+#define FXOS8700_MAX_NUM_BYTES (FXOS8700_BYTES_PER_CHANNEL_NORMAL * \
+ FXOS8700_MAX_NUM_CHANNELS)
+
+enum fxos8700_power {
+ FXOS8700_POWER_STANDBY = 0,
+ FXOS8700_POWER_ACTIVE,
+};
+
+enum fxos8700_mode {
+ FXOS8700_MODE_ACCEL = 0,
+ FXOS8700_MODE_MAGN = 1,
+ FXOS8700_MODE_HYBRID = 3,
+};
+
+enum fxos8700_range {
+ FXOS8700_RANGE_2G = 0,
+ FXOS8700_RANGE_4G,
+ FXOS8700_RANGE_8G,
+};
+
+enum fxos8700_channel {
+ FXOS8700_CHANNEL_ACCEL_X = 0,
+ FXOS8700_CHANNEL_ACCEL_Y,
+ FXOS8700_CHANNEL_ACCEL_Z,
+ FXOS8700_CHANNEL_MAGN_X,
+ FXOS8700_CHANNEL_MAGN_Y,
+ FXOS8700_CHANNEL_MAGN_Z,
+};
+
+struct fxos8700_config {
+ char *i2c_name;
+ uint8_t i2c_address;
+ uint8_t whoami;
+ enum fxos8700_mode mode;
+ enum fxos8700_range range;
+ uint8_t start_addr;
+ uint8_t start_channel;
+ uint8_t num_channels;
+};
+
+struct fxos8700_data {
+ struct device *i2c;
+ struct nano_sem sem;
+ int16_t raw[FXOS8700_MAX_NUM_CHANNELS];
+};