Nordic Thingy:52 v2.2.0
drv_acc.h
1 /*
2  Copyright (c) 2010 - 2017, Nordic Semiconductor ASA
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form, except as embedded into a Nordic
12  Semiconductor ASA integrated circuit in a product or a software update for
13  such product, must reproduce the above copyright notice, this list of
14  conditions and the following disclaimer in the documentation and/or other
15  materials provided with the distribution.
16 
17  3. Neither the name of Nordic Semiconductor ASA nor the names of its
18  contributors may be used to endorse or promote products derived from this
19  software without specific prior written permission.
20 
21  4. This software, with or without modification, must only be used with a
22  Nordic Semiconductor ASA integrated circuit.
23 
24  5. Any software provided in binary form under this license must not be reverse
25  engineered, decompiled, modified and/or disassembled.
26 
27  THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29  OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30  DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
47 #ifndef __DRV_ACC_H__
48 #define __DRV_ACC_H__
49 
50 #include <stdbool.h>
51 #include <stdint.h>
52 #include "nrf_drv_twi.h"
53 
56 enum
57 {
62 };
63 
66 typedef struct
67 {
68  uint8_t twi_addr;
69  nrf_drv_twi_t const * p_twi_instance;
70  nrf_drv_twi_config_t const * p_twi_cfg;
71  uint8_t cpu_wake_pin;
73 
85 ret_code_t drv_acc_wakeup_prepare(bool p_wakeup);
86 
96 ret_code_t drv_acc_init(drv_acc_cfg_t const * const p_cfg);
97 
98 #endif /* __DRV_ACC_H__ */
99 
Invalid parameters.
Definition: drv_acc.h:59
ret_code_t drv_acc_wakeup_prepare(bool p_wakeup)
Function for preparing for sleep and subsequent wakeup.
nrf_drv_twi_t const * p_twi_instance
The instance of TWI master to be used for transactions.
Definition: drv_acc.h:69
ret_code_t drv_acc_init(drv_acc_cfg_t const *const p_cfg)
Function for initializing the accelerometer driver.
nrf_drv_twi_config_t const * p_twi_cfg
The TWI configuration to use while the driver is enabled.
Definition: drv_acc.h:70
The driver is unitialized, please initialize.
Definition: drv_acc.h:61
Wrong device at I2C (TWI) address.
Definition: drv_acc.h:60
LIS3DH accelerometer configuration struct.
Definition: drv_acc.h:66
Successful.
Definition: drv_acc.h:58
uint8_t twi_addr
TWI (I2C) address of device.
Definition: drv_acc.h:68
uint8_t cpu_wake_pin
Pin on the nRF used to wake from sleep.
Definition: drv_acc.h:71