aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common/Utilities
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-08-16 23:31:55 +0300
committerShlomo Hecht <shlomo@twine-s.com>2020-08-16 23:31:55 +0300
commit5260452ded0983a5f71692625cafe2f2897178ef (patch)
treea89af9721ab9534d98591d4c57983b50f1469c2e /Software/Embedded_SW/Embedded/Common/Utilities
parentccb92223657ac5a21af5aa21d309d9924d9a0fd8 (diff)
downloadTango-5260452ded0983a5f71692625cafe2f2897178ef.tar.gz
Tango-5260452ded0983a5f71692625cafe2f2897178ef.zip
some changes before 1.4.6.42/ mostly moving delay.c to utilities
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common/Utilities')
-rw-r--r--Software/Embedded_SW/Embedded/Common/Utilities/delay.c42
-rw-r--r--Software/Embedded_SW/Embedded/Common/Utilities/delay.h17
2 files changed, 59 insertions, 0 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/delay.c b/Software/Embedded_SW/Embedded/Common/Utilities/delay.c
new file mode 100644
index 000000000..ef095fe5b
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Common/Utilities/delay.c
@@ -0,0 +1,42 @@
+/*
+ * delay.c - Delay in millisecond and microsecond functions
+ *
+ * Convert from SysCtlDelay in TivaWare library to milliseconds and microseconds delay.
+ *
+ * Created on: Dec 13, 2018
+ * Author: avi
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "driverlib/sysctl.h"
+#include "Include.h"
+
+
+
+void delayms(uint32_t ui32ms)
+{
+ //SysCtlClockGet();
+ // 1 clock cycle = 1 / SysCtlClockGet() second
+ // 1 SysCtlDelay = 3 clock cycle = 3 / SysCtlClockGet() second
+ // 1 second = SysCtlClockGet() / 3
+ // 0.001 second = 1 ms = SysCtlClockGet() / 3 / 1000
+ //int i;
+
+ //for(i=0;i<(ui32ms);i++)
+
+ //if(ui32ms == 10)
+ // ui32ms = 20;
+
+ SysCtlDelay( ui32ms * (SYS_CLK_FREQ / 3 / 1000));
+}
+
+void delayUs(uint32_t ui32Us)
+{
+ SysCtlDelay(ui32Us * (SYS_CLK_FREQ / 3 / 1000000));
+}
+
+
+
+
+
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/delay.h b/Software/Embedded_SW/Embedded/Common/Utilities/delay.h
new file mode 100644
index 000000000..a070cae1d
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Common/Utilities/delay.h
@@ -0,0 +1,17 @@
+/*
+ * delay.h
+ *
+ * Created on: Dec 13, 2018
+ * Author: avi
+ */
+
+#ifndef COMMON_UTILITIES_DELAY_H_
+#define COMMON_UTILITIES_DELAY_H_
+
+void delayms(uint32_t ui32ms);
+
+void delayUs(uint32_t ui32Us);
+
+
+
+#endif /* COMMON_UTILITIES_DELAY_H_ */