dikuei yen / Mbed 2 deprecated MTi_Gss_Motor

Dependencies:   mbed

Revision:
0:6bee2baac968
diff -r 000000000000 -r 6bee2baac968 PMW3901.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PMW3901.h	Mon Nov 15 08:25:54 2021 +0000
@@ -0,0 +1,42 @@
+/*
+ * PMW3901.h
+ *
+ *  Created on: 2020/7/22
+ *      Author: open4416
+ */
+
+#ifndef INC_PMW3901_H_
+#define INC_PMW3901_H_
+
+#include <math.h>
+
+//=========================================================================
+//Variables and arrays used for communications and data storage
+//=========================================================================
+int8_t deltaX_low, deltaY_low;    	//Stores the low-bits of movement data.
+int16_t deltaX_high, deltaY_high;   //Stores the high-bits of movement data.
+int16_t deltaX, deltaY;             //Stores the combined value of low and high bits.
+
+//=========================================================================
+//Functions used to communicate with the sensor and grab/print data
+//=========================================================================
+
+void delayus(uint32_t us);
+
+
+uint8_t readRegister(uint8_t addr);
+//This function takes an 8-bit address in the form 0x00 and returns an 8-bit value in the form 0x00.
+
+void writeRegister(uint8_t addr, uint8_t data);
+//This function takes an 8-bit address and 8-bit data. Writes the given data to the given address.
+
+void initializeSensor(void);
+//Sets all of the registers needed for initialization and performance optimization.
+
+void grabData(void);
+//Grabs the deltaX and deltaY information from the proper registers and formats it into the proper format.
+//
+//void printData(void);
+//Prints the data out to a serial terminal.
+
+#endif