Elevator v2.0
Elevator Documenation
Loading...
Searching...
No Matches
accelerometer.h
Go to the documentation of this file.
1
11#ifndef _ACCELEROMETER_H_
12#define _ACCELEROMETER_H_
13
14#include "driver/adc.h"
15#include <stdio.h>
16#include "freertos/FreeRTOS.h"
17#include "freertos/task.h"
22#define ACC_ADC_WIDTH (adc_bits_width_t)(ADC_WIDTH_BIT_12) // ADC width of 12 Bits 2**12 - 1
23#define X_AXIS (adc1_channel_t)(ADC1_CHANNEL_6) //X-axis adc channel 6
24#define Y_AXIS (adc1_channel_t)(ADC1_CHANNEL_7) //Y-axis adc channel 7
25#define Z_AXIS (adc1_channel_t)(ADC1_CHANNEL_4) //Z-axis adc channel 4
26#define ACC_ADC_ATTEN (adc_atten_t)(ADC_ATTEN_DB_11) // ADC attenuation set at 11 for range of 2600mV
27
45typedef struct
46{
47 adc_bits_width_t width;
48 adc1_channel_t xaxis;
49 adc1_channel_t yaxis;
50 adc1_channel_t zaxis;
51 adc_atten_t atten;
53
62
72int read_axis(Accelerometer *acc, int id);
73
74#endif
int read_axis(Accelerometer *acc, int id)
Read axis for the accelerometer.
Definition: accelerometer.c:40
void adcInit(Accelerometer *acc)
ADC initialization for the accelerometer.
Definition: accelerometer.c:20
Accelerometer acc
Definition: HAL_driver.c:13
Accelerometer struct for ADXL335.
Definition: accelerometer.h:46
adc_bits_width_t width
Definition: accelerometer.h:47
adc1_channel_t xaxis
Definition: accelerometer.h:48
adc1_channel_t zaxis
Definition: accelerometer.h:50
adc1_channel_t yaxis
Definition: accelerometer.h:49
adc_atten_t atten
Definition: accelerometer.h:51