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.
Diff: SPI_Encoder.h
- Revision:
- 0:21ae825df645
- Child:
- 1:7826ec4d9405
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SPI_Encoder.h Mon Jul 22 17:45:28 2019 +0000
@@ -0,0 +1,30 @@
+#ifndef SPI_ENCODER_H
+#define SPI_ENCODER_H
+
+#include "mbed.h"
+
+#define encoder_num 4
+
+
+class SPI_Encoder
+{
+ public:
+ SPI_Encoder(PinName mosi, PinName miso, PinName sclk, PinName cs0, PinName cs1, PinName cs2, PinName cs3);
+ void getPosition(int num);
+
+ uint16_t EncoderByteData[encoder_num];
+ uint16_t Encoderposition_last[encoder_num];
+ uint8_t temp[2][encoder_num];
+ uint16_t Steps[encoder_num];
+
+ private:
+ SPI encoder;
+ DigitalOut cs0;
+ DigitalOut cs1;
+ DigitalOut cs2;
+ DigitalOut cs3;
+ uint8_t _SPI_T (int num, uint8_t SPITransmit);
+ void _switching(int num, int value);
+};
+
+#endif