#include <stdio.h>
#include "s_accelerometer.h"
#include "board.h"
#include "gpio.h"
#include "pm.h"
#include "adc.h"
Data Structures | |
struct | S_acc_conv_t |
Functions | |
static void | acc_get_value (volatile avr32_adc_t *adc, unsigned char adc_channel_x, unsigned char adc_channel_y, unsigned char adc_channel_z, xyz_t *val) |
static char | acc_slow () |
static void | accelerometer_action_x (char *buf) |
static void | accelerometer_action_y (char *buf) |
void | accelerometer_init (void) |
Init the accelerometer driver. More... | |
void | accelerometer_measure (U32 angle, char *buf) |
Measures the accelerometer values and converts them to X and Y angles. More... | |
static void | xyz_diff (xyz_t p, xyz_t q, xyz_t *r) |
static int | xyz_sumsq (xyz_t p) |
Variables | |
Avr32_acc_t | acc |
struct S_acc_conv_t | acc_table [] |
volatile avr32_adc_t * | adc = (volatile avr32_adc_t *) &AVR32_ADC |
unsigned char | adc_channel_x = 1 |
unsigned char | adc_channel_y = 2 |
unsigned char | adc_channel_z = 3 |
xyz_t | g_angle |
|
static |
References ACC_SHIFT, adc_disable(), adc_enable(), adc_get_value(), adc_start(), xyz_t::x, xyz_t::y, and xyz_t::z.
Referenced by accelerometer_measure().
|
static |
References ACC_QUIET_HI, ACC_QUIET_LO, and Avr32_acc_t::ak2.
Referenced by accelerometer_action_x(), and accelerometer_action_y().
|
static |
References abs, acc_slow(), acc_table, Avr32_acc_t::ak, S_acc_conv_t::angle, S_acc_conv_t::sin, xyz_t::x, and xyz_t::z.
Referenced by accelerometer_measure().
|
static |
References abs, acc_slow(), acc_table, Avr32_acc_t::ak, S_acc_conv_t::angle, S_acc_conv_t::sin, xyz_t::y, and xyz_t::z.
Referenced by accelerometer_measure().
void accelerometer_init | ( | void | ) |
Init the accelerometer driver.
References adc, adc_configure(), and gpio_enable_module_pin().
Referenced by device_full_custom_task_init().
void accelerometer_measure | ( | U32 | angle, |
char * | buf | ||
) |
Measures the accelerometer values and converts them to X and Y angles.
angle | Boolean (0 for X-angle, 1 for Y-angle) |
buf | char buffer in which the light sensor value is stored. |
References acc_get_value(), accelerometer_action_x(), accelerometer_action_y(), adc, adc_channel_x, adc_channel_y, adc_channel_z, Avr32_acc_t::ak, Avr32_acc_t::ak2, Avr32_acc_t::g, Avr32_acc_t::k, Avr32_acc_t::m, xyz_t::x, xyz_diff(), xyz_sumsq(), xyz_t::y, and xyz_t::z.
Referenced by device_full_custom_task().
References xyz_t::x, xyz_t::y, and xyz_t::z.
Referenced by accelerometer_measure().
|
static |
References xyz_t::x, xyz_t::y, and xyz_t::z.
Referenced by accelerometer_measure().
Avr32_acc_t acc |
struct S_acc_conv_t acc_table[] |
Referenced by accelerometer_action_x(), and accelerometer_action_y().
volatile avr32_adc_t* adc = (volatile avr32_adc_t *) &AVR32_ADC |
Referenced by accelerometer_init(), accelerometer_measure(), b_light_get_value(), and b_temperature_get_value().
unsigned char adc_channel_x = 1 |
Referenced by accelerometer_measure().
unsigned char adc_channel_y = 2 |
Referenced by accelerometer_measure().
unsigned char adc_channel_z = 3 |
Referenced by accelerometer_measure().
xyz_t g_angle |