Hardware Application Layer for ADXL335 Accelerometer.
More...
#include "driver/adc.h"
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
Go to the source code of this file.
Hardware Application Layer for ADXL335 Accelerometer.
- Author
- Jesus Minjares (https://github.com/jminjares4)
- Version
- 0.1
- Date
- 2021-11-27
- Copyright
- Copyright (c) 2021
◆ ACC_ADC_ATTEN
#define ACC_ADC_ATTEN (adc_atten_t)(ADC_ATTEN_DB_11) |
◆ ACC_ADC_WIDTH
#define ACC_ADC_WIDTH (adc_bits_width_t)(ADC_WIDTH_BIT_12) |
Accelerometer Macros for modularity.
- Note
- Adjustable Macros to channel any of the adc pins of the accelerometer
◆ X_AXIS
#define X_AXIS (adc1_channel_t)(ADC1_CHANNEL_6) |
◆ Y_AXIS
#define Y_AXIS (adc1_channel_t)(ADC1_CHANNEL_7) |
◆ Z_AXIS
#define Z_AXIS (adc1_channel_t)(ADC1_CHANNEL_4) |
◆ adcInit()
ADC initialization for the accelerometer.
- Parameters
-
- Returns
- None
- Parameters
-
- Returns
- None
◆ read_axis()
Read axis for the accelerometer.
- Parameters
-
- Returns
- int adc raw from the desire id
- Note
- 0 X_AXIS, 1 Y_AXIS, 2 Z_AXIS, anything else will return 0
- Parameters
-
- Returns
- int adc raw from the desire id
- Note
- 0 X_AXIS, 1 Y_AXIS, 2 Z_AXIS, anything else will return 0
if 0: read x-axis elif 1: read y-axis elif 2: read z-axis else: 0