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: RWR_Utils.hxx
- Revision:
- 6:66889ef7193a
- Parent:
- 5:6cd52beadb7c
- Child:
- 7:7eae20ecd038
diff -r 6cd52beadb7c -r 66889ef7193a RWR_Utils.hxx
--- a/RWR_Utils.hxx Sat Jul 24 14:46:20 2021 +0300
+++ b/RWR_Utils.hxx Sat Jul 24 22:30:13 2021 +0300
@@ -34,11 +34,12 @@
#define QTR_THRESHOLD_LOW (uint32_t) 20000U
// PID parameters
-#define PID_SETPOINT 0.0f
-#define PID_KP 0.6f
-// #define PID_KP 0.25f
-#define PID_KI 0.0f
-#define PID_KD 0.0f
+#define PID_UPDATE_PERIOD_US 1000
+#define PID_SETPOINT 0.0f
+#define PID_KP 0.6f
+// #define PID_KP 0.25f
+#define PID_KI 0.0f
+#define PID_KD 0.0f
#define NO_LINE_SPEED_MOTOR_A 0.0f
#define NO_LINE_SPEED_MOTOR_B 1.0f
@@ -102,3 +103,16 @@
AnalogIn (&sensors)[SENSORS_BAR_SIZE];
uint32_t lastSensorState;
};
+
+class TimerWrapper
+{
+ public:
+ TimerWrapper(Timer &_timer);
+ int32_t read_ms();
+ int32_t read_us();
+ void reset();
+
+ private:
+ Timer &timer;
+ int32_t lastReset;
+};