Руслан Бредун / Mbed 2 deprecated STM32-MC_node

Dependencies:   mbed Watchdog stm32-sensor-base2

Revision:
12:406f75196a12
Parent:
5:97117a837d2c
Child:
18:025d9a617769
--- a/AS5045/AS5045.cpp	Wed Aug 26 14:26:27 2020 +0530
+++ b/AS5045/AS5045.cpp	Sun Dec 06 11:05:19 2020 +0000
@@ -15,10 +15,10 @@
     _cs(CS)				// Digital output pin init
 {
     // Set SPI bitwidth9
-    _spi.format(9, 2);
+    _spi.format(8, 1);
 
     // Set SPI frequency
-    _spi.frequency(500000);//SPI_FREQ);
+    _spi.frequency(SPI_FREQ);//SPI_FREQ);
     // Set the digital output high
     _cs = 1;
 }
@@ -64,7 +64,7 @@
  	//upper &=~ 0xF0;//mask out the first 4 bits
 //     EncoderByteData  = upper << 8; //shift MSB to correct EncoderByteData in EncoderByteData message
 //     EncoderByteData  += lower; // add LSB to EncoderByteData message to complete message
-  return ((upper << 3)+(lower >> 6));
+  return ((upper << 2)|(lower >> 6));
   //return EncoderByteData; 
 }
 
@@ -73,7 +73,7 @@
  *	@note
  *		Tick amount is recieved internally
  */
-float AS5045::getRotation()
+float AS5045::getAngle()
 {
     // Get data from the encoder
     float value = (float)getPosition();