Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Watchdog stm32-sensor-base2
AS5045/AS5045.h
- Committer:
- ruslanbredun
- Date:
- 2020-12-14
- Revision:
- 14:b3530522908e
- Parent:
- 12:406f75196a12
- Child:
- 17:0c8440955d31
File content as of revision 14:b3530522908e:
#ifndef AS5045_H #define AS5045_H #include "mbed.h" // Class which implements AS5045 encoder interface class AS5045 { public: AS5045(PinName cs); // Constructor int getPosition(); // Read tick amount from encoder (position) float getAngle(); // Convert position of the encoder to degrees private: SPI _spi; // MBED SPI instance DigitalOut _cs; uint16_t EncoderByteData; // MBED digital output pin static const float MAX_VALUE = 1024; // Maximum possible encoder position value (ticks for full rotation) static const float RESOLUTION = 0.3515625; // Encoder resolution (0.08789 degrees per tick) static const float SPI_FREQ = 500000; // Frequency of the SPI bus }; #endif // AS5045_H