Low-level driver for the Accelerometer MMA7341L.
This driver provides access to the main features of the Accelerometer MMA7341L.
Macros | |
#define | MMA7341L_SAMPLES 16 |
#define | TAN15 17 |
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... | |
static xyz_t | mma7341l_get_value (void) |
Get converted data from x,y,z axis. More... | |
void | mma7341l_init (void) |
Initialize MMA7341L. More... | |
void | mma7341l_set_mode (uint8_t uc_mode) |
Set MMA7341L working mode. More... | |
static void | mma7341l_update (void) |
Update ADC channel conversion value. More... | |
static xyz_t | mma7341l_xyz_add (xyz_t p, xyz_t q) |
Addition of two Position axis values. More... | |
static xyz_t | mma7341l_xyz_diff (xyz_t p, xyz_t q) |
Subtraction of two Position axis values. More... | |
Variables | |
acc_t | acc |
static float | f_volt_0g |
static float | f_volt_1g |
static uint8_t | uc_adc_channel_x |
static uint8_t | uc_adc_channel_y |
static uint8_t | uc_adc_channel_z |
#define MMA7341L_SAMPLES 16 |
Referenced by mma7341l_calibration().
#define TAN15 17 |
Referenced by mma7341l_get_rotation_dir().
void mma7341l_calibration | ( | void | ) |
Calibrate MMA7341L component and set the present axis value.
References acc_t::k, acc_t::m, mma7341l_get_value(), MMA7341L_SAMPLES, mma7341l_xyz_add(), xyz_t::x, xyz_t::y, and xyz_t::z.
xyz_g_t mma7341l_get_gravity_value | ( | void | ) |
Get the gravity value of x,y,z axis.
References f_volt_0g, acc_t::m, mma7341l_update(), xyz_t::x, xyz_g_t::x_g, xyz_t::y, xyz_g_t::y_g, xyz_t::z, and xyz_g_t::z_g.
uint32_t mma7341l_get_rotation_dir | ( | void | ) |
Check if the tilt angle is big enough.
If yes, get rotation direction according to the sign of two axes.
References acc_t::ak, acc_t::k, acc_t::m, MMA7341L_1G, MMA7341L_DOWM_RIGHT, MMA7341L_DOWN, MMA7341L_DOWN_LEFT, MMA7341L_LEFT, MMA7341L_RIGHT, MMA7341L_UNCHANGED, MMA7341L_UP, MMA7341L_UP_LEFT, MMA7341L_UP_RIGHT, mma7341l_update(), mma7341l_xyz_diff(), TAN15, xyz_t::x, xyz_t::y, and xyz_t::z.
|
static |
Get converted data from x,y,z axis.
References MMA7341L_SHIFT, xyz_t::x, xyz_t::y, and xyz_t::z.
Referenced by mma7341l_calibration(), and mma7341l_update().
void mma7341l_init | ( | void | ) |
Initialize MMA7341L.
References MMA7341L_ADC_CHANNEL_X, MMA7341L_ADC_CHANNEL_Y, and MMA7341L_ADC_CHANNEL_Z.
void mma7341l_set_mode | ( | uint8_t | uc_mode | ) |
Set MMA7341L working mode.
uc_mode | Working mode value (1 is normal and 0 is sleep). |
References gpio_set_pin_high, and gpio_set_pin_low.
|
static |
Update ADC channel conversion value.
References acc_t::m, and mma7341l_get_value().
Referenced by mma7341l_get_gravity_value(), and mma7341l_get_rotation_dir().
Addition of two Position axis values.
References xyz_t::x, xyz_t::y, and xyz_t::z.
Referenced by mma7341l_calibration().
Subtraction of two Position axis values.
References xyz_t::x, xyz_t::y, and xyz_t::z.
Referenced by mma7341l_get_rotation_dir().
acc_t acc |
Referenced by inet_chksum_pbuf(), inet_chksum_pseudo(), and inet_chksum_pseudo_partial().
|
static |
Referenced by mma7341l_get_gravity_value().
|
static |
|
static |
|
static |
|
static |