59 lines
2.4 KiB
C++
59 lines
2.4 KiB
C++
/**********************************************************************
|
|
Copyright (C) 2019 MisfitTech LLC, All rights reserved.
|
|
|
|
MisfitTech uses a dual license model that allows the software to be used under
|
|
a standard GPL open source license, or a commercial license. The standard GPL
|
|
license requires that all software statically linked with MisfitTec Code is
|
|
also distributed under the same GPL V2 license terms. Details of both license
|
|
options follow:
|
|
|
|
- Open source licensing -
|
|
MisfitTech is a free download and may be used, modified, evaluated and
|
|
distributed without charge provided the user adheres to version two of the GNU
|
|
General Public License (GPL) and does not remove the copyright notice or this
|
|
text. The GPL V2 text is available on the gnu.org web site
|
|
|
|
- Commercial licensing -
|
|
Businesses and individuals that for commercial or other reasons cannot comply
|
|
with the terms of the GPL V2 license must obtain a low cost commercial license
|
|
before incorporating MisfitTech code into proprietary software for distribution in
|
|
any form. Commercial licenses can be purchased from www.misfittech.net
|
|
and do not require any source files to be changed.
|
|
|
|
|
|
This code is distributed in the hope that it will be useful. You cannot
|
|
use MisfitTech's code unless you agree that you use the software 'as is'.
|
|
MisfitTech's code is provided WITHOUT ANY WARRANTY; without even the implied
|
|
warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
PURPOSE. MisfitTech LLC disclaims all conditions and terms, be they
|
|
implied, expressed, or statutory.
|
|
|
|
|
|
Written by Trampas Stern for MisfitTech.
|
|
|
|
Misfit Tech invests time and resources providing this open source code,
|
|
please support MisfitTech and open-source hardware by purchasing
|
|
products from MisfitTech, www.misifittech.net!
|
|
*********************************************************************/
|
|
#ifndef __AS5047D_H__
|
|
#define __AS5047D_H__
|
|
|
|
#include <Arduino.h>
|
|
#define AS5047D_DEGREES_PER_BIT (360.0/(float)(0x3FFF))
|
|
|
|
class AS5047D {
|
|
private:
|
|
int chipSelectPin;
|
|
int16_t readAddress(uint16_t addr);
|
|
bool error=false;
|
|
bool as5047d=true;
|
|
public:
|
|
boolean begin(int csPin);
|
|
int16_t readEncoderAngle(void);
|
|
void diagnostics(char *ptrStr);
|
|
int16_t readEncoderAnglePipeLineRead(void);
|
|
bool getError(void) {return error;};
|
|
};
|
|
|
|
#endif //__AS5047D_H__
|