-
Notifications
You must be signed in to change notification settings - Fork 0
/
AS5600.h
82 lines (67 loc) · 1.66 KB
/
AS5600.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/****************************************************
AMS 5600 class for Arduino platform
Author: Tom Denton
Date: 15 Dec 2014
File: AMS_5600.h
Version 1.00
www.ams.com
Description: This class has been designed to
access the AMS 5600 “potuino” shield.
***************************************************/
#ifndef AMS_5600_h
#define AMS_5600_h
#include <Arduino.h>
class AMS_5600
{
public:
AMS_5600(int i2cAddress = 0x36);
int getAddress();
word setMaxAngle(word newMaxAngle = -1);
word getMaxAngle();
word setStartPosition(word startAngle = -1);
word getStartPosition();
word setEndPosition(word endAngle = -1);
word getEndPosition();
word getRawAngle();
word getScaledAngle();
int detectMagnet();
int getMagnetStrength();
int getAgc();
word getMagnitude();
word getConf();
void setConf(word _conf);
int getBurnCount();
int burnAngle();
int burnMaxAngleAndConfig();
void setOutPut(uint8_t mode);
private:
int _ams5600_Address;
word _rawStartAngle;
word _zPosition;
word _rawEndAngle;
word _mPosition;
word _maxAngle;
/* Registers */
int _zmco;
int _zpos_hi; /*zpos[11:8] high nibble START POSITION */
int _zpos_lo; /*zpos[7:0] */
int _mpos_hi; /*mpos[11:8] high nibble STOP POSITION */
int _mpos_lo; /*mpos[7:0] */
int _mang_hi; /*mang[11:8] high nibble MAXIMUM ANGLE */
int _mang_lo; /*mang[7:0] */
int _conf_hi;
int _conf_lo;
int _raw_ang_hi;
int _raw_ang_lo;
int _ang_hi;
int _ang_lo;
int _stat;
int _agc;
int _mag_hi;
int _mag_lo;
int _burn;
int readOneByte(int in_adr);
word readTwoBytes(int in_adr);
void writeOneByte(int adr_in, int dat_in);
};
#endif