text
stringlengths 0
80
|
---|
/* Copyright (C) 2016 STMicroelectronics |
* |
* 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. |
* |
* |
* File Name : ais328dq_acc.c |
* Authors : VMA - Volume Mems & Analog Division |
* : Matteo Dameno (matteo.dameno@st.com) |
* : Lorenzo Bianconi (lorenzo.bianconi@st.com) |
* : Author is willing to be considered the contact |
* : and update point for the driver. |
* Version : V 1.0.1 |
* Date : 2016/05/27 |
* Description : AIS328DQ 3D accelerometer sensor LDD |
* |
****************************************************************************** |
* Revision 1.0.0 2011/03/02 |
* first release |
* Revision 1.0.1 2012/10/07 |
* corrects default permissions on sysfs files |
*****************************************************************************/ |
#include <linux/err.h> |
#include <linux/errno.h> |
#include <linux/delay.h> |
#include <linux/fs.h> |
#include <linux/input.h> |
#include <linux/uaccess.h> |
#include <linux/workqueue.h> |
#include <linux/irq.h> |
#include <linux/gpio.h> |
#include <linux/interrupt.h> |
#include <linux/slab.h> |
#include <linux/module.h> |
#include "ais328dq.h" |
#define SENSITIVITY_2G 1 /** mg/LSB */ |
#define SENSITIVITY_4G 2 /** mg/LSB */ |
#define SENSITIVITY_8G 4 /** mg/LSB */ |
#define AXISDATA_REG 0x28 |
#define WHOAMI_AIS328DQ_ACC 0x32 /* Expctd content for WAI */ |
/* CONTROL REGISTERS ADDRESSES */ |
#define WHO_AM_I 0x0F /* WhoAmI register */ |
#define CTRL_REG1 0x20 /* */ |
#define CTRL_REG2 0x21 /* */ |
#define CTRL_REG3 0x22 /* */ |
#define CTRL_REG4 0x23 /* */ |
#define CTRL_REG5 0x24 /* */ |
#define INT_CFG1 0x30 /* interrupt 1 config */ |
#define INT_SRC1 0x31 /* interrupt 1 source */ |
#define INT_THS1 0x32 /* interrupt 1 threshold */ |
#define INT_DUR1 0x33 /* interrupt 1 duration */ |
#define INT_CFG2 0x34 /* interrupt 2 config */ |
#define INT_SRC2 0x35 /* interrupt 2 source */ |
#define INT_THS2 0x36 /* interrupt 2 threshold */ |
#define INT_DUR2 0x37 /* interrupt 2 duration */ |
/* end CONTROL REGISTRES ADDRESSES */ |
#define AIS328DQ_ACC_ENABLE_ALL_AXES 0x07 |
#define AIS328DQ_SELFTEST_EN 0x02 |
#define AIS328DQ_SELFTEST_DIS 0x00 |
#define AIS328DQ_SELFTEST_POS 0x00 |
#define AIS328DQ_SELFTEST_NEG 0x08 |
#define AIS328DQ_ACC_BDU_EN 0x80 |
/* Accelerometer output data rate */ |
#define AIS328DQ_ACC_ODRHALF 0x40 /* 0.5Hz output data rate */ |
#define AIS328DQ_ACC_ODR1 0x60 /* 1Hz output data rate */ |
#define AIS328DQ_ACC_ODR2 0x80 /* 2Hz output data rate */ |
#define AIS328DQ_ACC_ODR5 0xA0 /* 5Hz output data rate */ |
#define AIS328DQ_ACC_ODR10 0xC0 /* 10Hz output data rate */ |
#define AIS328DQ_ACC_ODR50 0x00 /* 50Hz output data rate */ |
#define AIS328DQ_ACC_ODR100 0x08 /* 100Hz output data rate */ |
#define AIS328DQ_ACC_ODR400 0x10 /* 400Hz output data rate */ |
#define AIS328DQ_ACC_ODR1000 0x18 /* 1000Hz output data rate */ |
/* RESUME STATE INDICES */ |
#define RES_CTRL_REG1 0 |
#define RES_CTRL_REG2 1 |
#define RES_CTRL_REG3 2 |
#define RES_CTRL_REG4 3 |
#define RES_CTRL_REG5 4 |
#define RES_REFERENCE 5 |
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 4