Energy harvesting mobile robot. Developed at Institute of Systems and Robotics — University of Coimbra.

Dependencies:   RF24

Fork of ISR_Mini-explorer by ISR UC

Encoder.h

Committer:
ISR
Date:
2018-02-20
Revision:
1:8569ac717e68

File content as of revision 1:8569ac717e68:

#ifndef ENCODER_H
#define ENCODER_H

#include "mbed.h"

/** Encoder class.
 * Manages one magnetic encoder AS5600. Reads its absolute value and performs
 * the conversion of the value to incremental valeu.
 */
class Encoder
{
public:
    Encoder(I2C* i2c_in, Mutex* mutex_in, char invert_in);
    long int readAbsolute();
    long int incremental();
    long int readIncrementalValue();

private:
    I2C* _i2c;
    Mutex* _mutex;
    short int prev_L;
    long int total_L;
    char _invert;
};

#endif