Microchip® Advanced Software Framework

mma7341l.h File Reference

API driver for MMA7341L accelerometer component.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"
#include "board.h"
#include "conf_mma7341l.h"

Data Structures

struct  acc_t
 
struct  xyz_g_t
 
struct  xyz_t
 

Macros

#define MMA7341L_1G   (0x88 >> MMA7341L_SHIFT)
 Accelerometer delta 1g digital value is 0.44/3.3 * 0x400 (10-bit ADC) More...
 
#define MMA7341L_ADC_CHANNEL_X   2
 
#define MMA7341L_ADC_CHANNEL_Y   6
 
#define MMA7341L_ADC_CHANNEL_Z   7
 
#define MMA7341L_DOWM_RIGHT   8
 
#define MMA7341L_DOWN   2
 
#define MMA7341L_DOWN_LEFT   7
 
#define MMA7341L_EOC_X   (0x1u << MMA7341L_ADC_CHANNEL_X)
 
#define MMA7341L_EOC_Y   (0x1u << MMA7341L_ADC_CHANNEL_Y)
 
#define MMA7341L_EOC_Z   (0x1u << MMA7341L_ADC_CHANNEL_Z)
 
#define MMA7341L_LEFT   3
 
#define MMA7341L_NORMAL_MODE   1
 Definition of MMA7341L working mode. More...
 
#define MMA7341L_RIGHT   4
 
#define MMA7341L_SHIFT   0
 Accelerometer filtering value. More...
 
#define MMA7341L_SLEEP_MODE   0
 
#define MMA7341L_UNCHANGED   0
 
#define MMA7341L_UP   1
 
#define MMA7341L_UP_LEFT   6
 
#define MMA7341L_UP_RIGHT   5
 
#define MMA7341L_ZERO   (0x1FF >> MMA7341L_SHIFT)
 Accelerometer 0g output voltage value is 1.65v, converted digital value 0x400/2 (10-bit ADC) More...
 
#define MMA7341L_ZERO_X   MMA7341L_ZERO
 
#define MMA7341L_ZERO_Y   MMA7341L_ZERO
 
#define MMA7341L_ZERO_Z   MMA7341L_ZERO
 

Functions

void mma7341l_calibration (void)
 Calibrate MMA7341L component and set the present axis value. More...
 
xyz_g_t mma7341l_get_gravity_value (void)
 Get the gravity value of x,y,z axis. More...
 
uint32_t mma7341l_get_rotation_dir (void)
 Check if the tilt angle is big enough. More...
 
void mma7341l_init (void)
 Initialize MMA7341L. More...
 
void mma7341l_set_mode (uint8_t uc_mode)
 Set MMA7341L working mode. More...
 

#define MMA7341L_1G   (0x88 >> MMA7341L_SHIFT)

Accelerometer delta 1g digital value is 0.44/3.3 * 0x400 (10-bit ADC)

Referenced by mma7341l_get_rotation_dir().

#define MMA7341L_ADC_CHANNEL_X   2

Referenced by mma7341l_init().

#define MMA7341L_ADC_CHANNEL_Y   6

Referenced by mma7341l_init().

#define MMA7341L_ADC_CHANNEL_Z   7

Referenced by mma7341l_init().

#define MMA7341L_DOWM_RIGHT   8
#define MMA7341L_DOWN   2
#define MMA7341L_DOWN_LEFT   7
#define MMA7341L_EOC_X   (0x1u << MMA7341L_ADC_CHANNEL_X)
#define MMA7341L_EOC_Y   (0x1u << MMA7341L_ADC_CHANNEL_Y)
#define MMA7341L_EOC_Z   (0x1u << MMA7341L_ADC_CHANNEL_Z)
#define MMA7341L_LEFT   3
#define MMA7341L_NORMAL_MODE   1

Definition of MMA7341L working mode.

#define MMA7341L_RIGHT   4
#define MMA7341L_SHIFT   0

Accelerometer filtering value.

Referenced by mma7341l_get_value().

#define MMA7341L_SLEEP_MODE   0
#define MMA7341L_UNCHANGED   0
#define MMA7341L_UP   1
#define MMA7341L_UP_LEFT   6
#define MMA7341L_UP_RIGHT   5
#define MMA7341L_ZERO   (0x1FF >> MMA7341L_SHIFT)

Accelerometer 0g output voltage value is 1.65v, converted digital value 0x400/2 (10-bit ADC)

#define MMA7341L_ZERO_X   MMA7341L_ZERO
#define MMA7341L_ZERO_Y   MMA7341L_ZERO
#define MMA7341L_ZERO_Z   MMA7341L_ZERO