Page MenuHomec4science

magnetic_encoder.h
No OneTemporary

File Metadata

Created
Sun, Dec 1, 04:11

magnetic_encoder.h

#ifndef MAGNETIC_ENCODER_H_
#define MAGNETIC_ENCODER_H_
#include <sbcp-uc/gpio.h>
struct magnetic_encoder;
typedef struct magnetic_encoder magnetic_encoder;
void init_magnetic_encoders(gpio spi_cs);
/**
* Swaps position of Q2 and Q3 in hardware flow,
* if swapped is not zero. Otherwise keep their position.
*/
void magnetic_encoder_swap_2_and_3(int swapped);
void magnetic_encoders_process();
void magnetic_encoders_start_reading();
void me_load_persistent_sbcp_settings();
enum me_error_flags {
ME_F_OK = 0 ,
ME_F_LINEARITY_READ_ALARM = 1 << 0,
ME_F_CORDIC_OVERFLOW = 1 << 1,
ME_F_ONBOARD_PROCESSING_UNFINISHED = 1 << 2,
ME_F_MAGNETIC_AMPLITUDE_ERROR = 1 << 3
};
typedef enum me_error_flags me_error_flags;
void me_set_gear_ratio(magnetic_encoder * e, int mult, int div);
int me_get_gear_mult(magnetic_encoder * e);
int me_get_gear_div(magnetic_encoder * e);
int me_get_value(magnetic_encoder * e);
me_error_flags me_get_error(magnetic_encoder * e);
extern magnetic_encoder * me1,* me2,* me3;
#endif //MAGNETIC_ENCODER_H_

Event Timeline