KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lsm303.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2012-2019 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  */
10 
11 #ifndef DRV_I2C_LSM303_H_
12 #define DRV_I2C_LSM303_H_
13 /**
14  * @file lsm303.h
15  *
16  * @date 19 jun. 2019
17  * @author V. van Beveren
18  *
19  * @ingroup i2cdrivers
20  *
21  * Common structures shared over both LSM303* devices.
22  */
23 
24 #include "drv/wb/i2c.h"
25 #include <stdbool.h>
26 #include <stdint.h>
27 
28 /**
29  * Axis structure for 3D information.
30  */
31 typedef struct Lsm303Axis_ {
32  int16_t x;
33  int16_t y;
34  int16_t z;
35 } Lsm303Axis;
36 
37 
38 /**
39  * Function shared for both LSM303 drivers. Do not use.
40  */
41 static inline uint16_t _lsm303RawDataToI16(uint8_t * data)
42 {
43  return (int16_t)(data[0] | (data[1] << 8));
44 }
45 
46 /**
47  * Internal function shared for both LSM303 drivers. Do not use.
48  */
49 void _lsm303RawDataToAxis(uint8_t * data, Lsm303Axis * axis);
50 
51 /**
52  * Internal function shared for both LSM303 drivers. Do not use.
53  */
54 bool _lsm303RmwReg(I2C_Device * dev, uint8_t addr, uint8_t reg, uint8_t val, uint8_t mask);
55 
56 
57 #endif /* DRV_I2C_LSM303_H_ */
Axis structure for 3D information.
Definition: lsm303.h:31
bool _lsm303RmwReg(I2C_Device *dev, uint8_t addr, uint8_t reg, uint8_t val, uint8_t mask)
Internal function shared for both LSM303 drivers.
Definition: lsm303.c:22
struct Lsm303Axis_ Lsm303Axis
Axis structure for 3D information.
static uint16_t _lsm303RawDataToI16(uint8_t *data)
Function shared for both LSM303 drivers.
Definition: lsm303.h:41
void _lsm303RawDataToAxis(uint8_t *data, Lsm303Axis *axis)
Internal function shared for both LSM303 drivers.
Definition: lsm303.c:15
Structure defines OpenCores I2C Device.
Definition: dev_i2c.h:55
OpenCores I2C device driver.