SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
MagneticSensorAnalog.h
Go to the documentation of this file.
1#ifndef MAGNETICSENSORANALOG_LIB_H
2#define MAGNETICSENSORANALOG_LIB_H
3
4#include "Arduino.h"
5#include "../common/base_classes/Sensor.h"
6#include "../common/foc_utils.h"
7#include "../common/time_utils.h"
8
9/**
10 * This sensor has been tested with AS5600 running in 'analog mode'. This is where output pin of AS6000 is connected to an analog pin on your microcontroller.
11 * This approach is very simple but you may more accurate results with MagneticSensorI2C if that is also supported as its skips the DAC -> ADC conversion (ADC supports MagneticSensorI2C)
12 */
14 public:
15 /**
16 * MagneticSensorAnalog class constructor
17 * @param _pinAnalog the pin to read the PWM signal
18 */
19 MagneticSensorAnalog(uint8_t _pinAnalog, int _min = 0, int _max = 0);
20
21
22 /** sensor initialise pins */
23 void init();
24
25 int pinAnalog; //!< encoder hardware pin A
26
27 // Encoder configuration
29
30 // implementation of abstract functions of the Sensor class
31 /** get current angle (rad) */
32 float getSensorAngle() override;
33 /** raw count (typically in range of 0-1023), useful for debugging resolution issues */
35
36 private:
37 int min_raw_count;
38 int max_raw_count;
39 int cpr;
40 int read();
41
42 /**
43 * Function getting current angle register value
44 * it uses angle_register variable
45 */
46 int getRawCount();
47
48};
49
50
51#endif
Pullup
Definition Sensor.h:19
int pinAnalog
encoder hardware pin A
float getSensorAngle() override