You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.6 KiB
76 lines
2.6 KiB
/* |
|
* Copyright (C) 2012 Lorenz Meier. All rights reserved. |
|
* |
|
* 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 of the author or the names of 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. |
|
*/ |
|
|
|
/* |
|
* Driver for the Meas Spec MS5611 barometric pressure sensor |
|
*/ |
|
|
|
#include <sys/ioctl.h> |
|
|
|
#define _MS5611BASE 0x6A00 |
|
#define MS5611C(_x) _IOC(_MS5611BASE, _x) |
|
|
|
/* |
|
* Sets the sensor internal sampling rate, and if a buffer |
|
* has been configured, the rate at which entries will be |
|
* added to the buffer. |
|
*/ |
|
#define MS5611_SETRATE MS5611C(1) |
|
|
|
/* set rate (configuration A register */ |
|
#define MS5611_RATE_0_75HZ (0 << 2) /* 0.75 Hz */ |
|
|
|
/* |
|
* Sets the sensor internal range. |
|
*/ |
|
#define MS5611_SETRANGE MS5611C(2) |
|
|
|
#define MS5611_RANGE_0_88GA (0 << 5) |
|
|
|
/* |
|
* Sets the address of a shared MS5611_buffer |
|
* structure that is maintained by the driver. |
|
* |
|
* If zero is passed as the address, disables |
|
* the buffer updating. |
|
*/ |
|
#define MS5611_SETBUFFER MS5611C(3) |
|
|
|
struct ms5611_buffer { |
|
uint32_t size; /* number of entries in the samples[] array */ |
|
uint32_t next; /* the next entry that will be populated */ |
|
struct { |
|
uint32_t pressure; |
|
uint16_t temperature; |
|
} samples[]; |
|
}; |
|
|
|
extern int ms5611_attach(struct i2c_dev_s *i2c);
|
|
|