PicoWAN SDK Documentation
Data Structures | Macros | Functions
lis2de12.h File Reference

ST LIS2DE12 accelerometer driver. More...

#include "i2c.h"

Go to the source code of this file.

Data Structures

struct  lis2de12_accel_data
 

Macros

#define LIS2DE12_INT1   0x01
 
#define LIS2DE12_INT2   0x02
 

Functions

uint8_t lis2de12_is_enabled (void)
 Checks if the accelerometer is enabled. More...
 
void lis2de12_get_accel (struct lis2de12_accel_data *data)
 Gets the raw acceleration values. More...
 
void lis2de12_handle_int (uint8_t pin)
 Handles the accelerometer IRQs. More...
 
uint8_t lis2de12_init (uint8_t i2c_port)
 Initializes the accelerometer driver. More...
 
void lis2de12_deinit (void)
 Deinitializes the accelerometer driver.
 

Detailed Description

ST LIS2DE12 accelerometer driver.

Copyright (c) 2018, Archos S.A. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND AND 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 ARCHOS S.A. 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.

Function Documentation

void lis2de12_get_accel ( struct lis2de12_accel_data data)

Gets the raw acceleration values.

Parameters
dataA pointer to the structure that will hold the raw values.
void lis2de12_handle_int ( uint8_t  pin)

Handles the accelerometer IRQs.

The function handles the accelerometer IRQs, and must be called to clear it on the accelerometer side.

Parameters
pinThe accelerometer pin that triggered the IRQ. This can be LIS2DE12_INT1 or LIS2DE12_INT2
uint8_t lis2de12_init ( uint8_t  i2c_port)

Initializes the accelerometer driver.

Parameters
i2c_portThe I2C port to which the accelerometer is attached. This should be I2C_PORT_n where n is the I2C port number.
Return values
uint8_t0 if the initialization is successful, 1 otherwise.
uint8_t lis2de12_is_enabled ( void  )

Checks if the accelerometer is enabled.

Return values
uint8_t1 if the accelerometer is enabled, 0 otherwise.