Browse Source

add:mcu的tick相关c层接口,给lua用

alienwalker 4 years ago
parent
commit
b973c34530
1 changed files with 19 additions and 2 deletions
  1. 19 2
      application/src/luat_mcu_air105.c

+ 19 - 2
application/src/luat_mcu_air105.c

@@ -25,13 +25,13 @@
 #include "app_interface.h"
 
 #include "FreeRTOS.h"
-
+extern uint32_t SystemCoreClock;
 int luat_mcu_set_clk(size_t mhz) {
     return 0;
 }
 
 int luat_mcu_get_clk(void) {
-    return 0;
+    return SystemCoreClock/1000000;
 }
 
 static uint8_t unique_id[16] = {0};
@@ -44,3 +44,20 @@ const char* luat_mcu_unique_id(size_t* t) {
 long luat_mcu_ticks(void) {
     return GetSysTickMS();
 }
+
+uint32_t luat_mcu_hz(void) {
+    return 1000;
+}
+
+uint64_t luat_mcu_tick64(void) {
+	return GetSysTick();
+}
+
+int luat_mcu_us_period(void) {
+	return SYS_TIMER_1US;
+}
+
+void luat_mcu_delay_us(int delay)
+{
+	Task_DelayUS(delay);
+}