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:
fabiofaria
Date:
2018-04-19
Revision:
4:560d24c0e5f8
Parent:
1:8569ac717e68

File content as of revision 4:560d24c0e5f8:

#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