#include "imu_functions.h"
#include "spi_functions.h"
#include "gpio_functions.h"
#include "encoder_functions.h"
#include "imu_regs.h"
Go to the source code of this file.
Data Structures | |
struct | IMU_PARAM_STRUCT |
Configs of IMU. More... | |
struct | IMU_PARAM_STRUCT::param_acc |
Accelerometer Parameters. More... | |
struct | IMU_PARAM_STRUCT::param_gyr |
Gyrometer Parameters. More... | |
struct | IMU_PARAM_STRUCT::param_mag |
Magnetometer Parameters. More... | |
struct | SPI_PARAM_STRUCT |
Configs for SPI. More... | |
struct | DATA_XYZ |
A structure to represent a 3d Vector. More... | |
struct | DATA_XYZ_DOUBLE |
Vector definition on double. More... | |
struct | IMU_DATA_STRUCT |
Data of IMU structure. More... | |
struct | IMU_DATA_STRUCT::calibrated |
struct | EFF_DATA_STRUCT |
struct | MRA_DATA_STRUCT |
Struct to control MRA. More... | |
Macros | |
#define | GPIO_CS_S0 168 |
#define | GPIO_CS_S1 64 |
#define | GPIO_CS_S2 176 |
#define | GPIO_CS_S3 65 |
#define | GPIO_DAC_SHDN 66 |
#define | GPIO_DAC_LDAC 67 |
#define | USE_ENCODER 1 |
#define | USE_IMU 1 |
#define | USE_SPI 1 |
Functions | |
int | devices_init (IMU_PARAM_STRUCT *imu_param, SPI_PARAM_STRUCT *spi_param, MRA_DATA_STRUCT *mra_data) |
INITIALIZATION OF SENSORS AND DEVICES. More... | |
int | devices_close (IMU_PARAM_STRUCT *imu_param, SPI_PARAM_STRUCT *spi_param, MRA_DATA_STRUCT *mra_data) |
Fuction to close all communication with the sensors and devices. More... | |
int | read_all_data (int i2c_dev, int spi_dev, IMU_DATA_STRUCT *imu_data, EFF_DATA_STRUCT *eff_data, MRA_DATA_STRUCT *mra_data, ENC_DATA_STRUCT *enc_data) |
READ ALL DATA FROM SENSORS AND ADC. More... | |
void | actuate (int spi_dev, MRA_DATA_STRUCT *mra_data) |
Applies the control signal to the actuator. More... | |
void | mra_shut_down (void) |
Turn off MRA. More... | |
Definition in file communication.h.
#define GPIO_CS_S0 168 |
Definition at line 16 of file communication.h.
Referenced by actuate(), and read_all_data().
#define GPIO_CS_S1 64 |
Definition at line 17 of file communication.h.
Referenced by actuate(), and read_all_data().
#define GPIO_CS_S2 176 |
Definition at line 18 of file communication.h.
Referenced by actuate(), and read_all_data().
#define GPIO_CS_S3 65 |
Definition at line 19 of file communication.h.
Referenced by actuate(), and read_all_data().
#define GPIO_DAC_LDAC 67 |
Definition at line 22 of file communication.h.
#define GPIO_DAC_SHDN 66 |
Definition at line 21 of file communication.h.
Referenced by actuate(), and dac_shut_down().
#define USE_ENCODER 1 |
Definition at line 24 of file communication.h.
#define USE_IMU 1 |
Definition at line 25 of file communication.h.
#define USE_SPI 1 |
Definition at line 26 of file communication.h.
void actuate | ( | int | spi_dev, |
MRA_DATA_STRUCT * | mra_data | ||
) |
Applies the control signal to the actuator.
spi_dev | Containing SPI variable ID |
mra_data | Struct containing the control signal |
Definition at line 179 of file communication.c.
References dac_write(), FAILURE, GPIO_CS_S0, GPIO_CS_S1, GPIO_CS_S2, GPIO_CS_S3, GPIO_DAC_SHDN, gpio_write(), MRA_DATA_STRUCT::new_ctl, SUCCESS, and MRA_DATA_STRUCT::v_ctl.
Referenced by control_task(), devices_close(), devices_init(), and periodic_task_1().
int devices_close | ( | IMU_PARAM_STRUCT * | imu_param, |
SPI_PARAM_STRUCT * | spi_param, | ||
MRA_DATA_STRUCT * | mra_data | ||
) |
Fuction to close all communication with the sensors and devices.
[long description]
imu_param | [description] |
spi_param | [description] |
mra_data | [description] |
Definition at line 82 of file communication.c.
References actuate(), IMU_PARAM_STRUCT::i2c_dev, SPI_PARAM_STRUCT::spi_dev, SUCCESS, and MRA_DATA_STRUCT::v_ctl.
Referenced by main().
int devices_init | ( | IMU_PARAM_STRUCT * | imu_param, |
SPI_PARAM_STRUCT * | spi_param, | ||
MRA_DATA_STRUCT * | mra_data | ||
) |
INITIALIZATION OF SENSORS AND DEVICES.
*imu_param | Structure with IMU parameters |
*spi_param | Structure with SPI parameters |
*mra_data | Structure to control MRA |
Definition at line 12 of file communication.c.
References IMU_PARAM_STRUCT::acc, acc_init(), IMU_PARAM_STRUCT::param_gyr::act, actuate(), ADD_ADXL345, ADD_HMC5883, ADD_ITG3200, IMU_PARAM_STRUCT::param_gyr::clk_source, SPI_PARAM_STRUCT::cs, FAILURE, IMU_PARAM_STRUCT::param_acc::full_res, IMU_PARAM_STRUCT::gyr, gyr_init(), IMU_PARAM_STRUCT::i2c_dev, IMU_PARAM_STRUCT::param_gyr::lpf_bw, IMU_PARAM_STRUCT::mag, mag_init(), IMU_PARAM_STRUCT::param_mag::meas_mode, SPI_PARAM_STRUCT::mode, MRA_DATA_STRUCT::new_ctl, IMU_PARAM_STRUCT::param_mag::op_mode, IMU_PARAM_STRUCT::param_acc::range, IMU_PARAM_STRUCT::param_mag::range, IMU_PARAM_STRUCT::param_acc::rate, IMU_PARAM_STRUCT::param_gyr::rate, IMU_PARAM_STRUCT::param_mag::rate, IMU_PARAM_STRUCT::param_mag::samples_avg, SPI_PARAM_STRUCT::speed, SPI_PARAM_STRUCT::spi_dev, spi_init(), SUCCESS, and MRA_DATA_STRUCT::v_ctl.
Referenced by main(), and periodic_task_2().
void mra_shut_down | ( | void | ) |
Turn off MRA.
int read_all_data | ( | int | i2c_dev, |
int | spi_dev, | ||
IMU_DATA_STRUCT * | imu_data, | ||
EFF_DATA_STRUCT * | eff_data, | ||
MRA_DATA_STRUCT * | mra_data, | ||
ENC_DATA_STRUCT * | enc_data | ||
) |
READ ALL DATA FROM SENSORS AND ADC.
i2c_dev | |
spi_dev | |
*imu_data | |
*eff_data | |
*mra_data |
Definition at line 94 of file communication.c.
References IMU_DATA_STRUCT::acc, acc_read_all_data(), adc_read(), ADD_ADXL345, ADD_HMC5883, ADD_ITG3200, ENC_DATA_STRUCT::calib, enc_read_pos(), EFF_DATA_STRUCT::F, FAILURE, GPIO_CS_S0, GPIO_CS_S1, GPIO_CS_S2, GPIO_CS_S3, gpio_write(), IMU_DATA_STRUCT::gyr, gyr_read_all_data(), IMU_DATA_STRUCT::mag, mag_read_all_data(), ENC_DATA_STRUCT::new_data, IMU_DATA_STRUCT::new_data, EFF_DATA_STRUCT::new_data, MRA_DATA_STRUCT::new_data, ENC_DATA_STRUCT::position, ENC_DATA_STRUCT::calibrate::position, ENC_DATA_STRUCT::spi_dev, SUCCESS, IMU_DATA_STRUCT::temp, MRA_DATA_STRUCT::v_ctl_read, DATA_XYZ::x, DATA_XYZ::y, and DATA_XYZ::z.
Referenced by control_task(), periodic_task_1(), and ui_task().