You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/08/19 19:49:25 UTC
[mynewt-core] 01/03: hw/mcu/da1469x: Move lpclk handling to
separate file
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 431cd96a4d3e219f6482bc21afa8dadc76fe623a
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Aug 7 18:07:44 2019 +0200
hw/mcu/da1469x: Move lpclk handling to separate file
---
hw/mcu/dialog/da1469x/src/da1469x_lpclk.c | 50 +++++++++++++++++++++++++++++++
hw/mcu/dialog/da1469x/src/hal_system.c | 22 --------------
2 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/hw/mcu/dialog/da1469x/src/da1469x_lpclk.c b/hw/mcu/dialog/da1469x/src/da1469x_lpclk.c
new file mode 100644
index 0000000..a5ce2e2
--- /dev/null
+++ b/hw/mcu/dialog/da1469x/src/da1469x_lpclk.c
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "syscfg/syscfg.h"
+#include "mcu/da1469x_clock.h"
+#include "hal/hal_system.h"
+#include "hal/hal_timer.h"
+#include "os/os_cputime.h"
+#include "DA1469xAB.h"
+#include "da1469x_priv.h"
+
+bool g_mcu_lpclk_available;
+
+static void
+da1469x_lpclk_settle_tmr_cb(void *arg)
+{
+ da1469x_clock_lp_xtal32k_switch();
+
+ g_mcu_lpclk_available = true;
+}
+
+void
+da1469x_lpclk_init(void)
+{
+ static struct hal_timer lpclk_settle_tmr;
+
+ da1469x_clock_lp_xtal32k_enable();
+
+ os_cputime_timer_init(&lpclk_settle_tmr, da1469x_lpclk_settle_tmr_cb, NULL);
+ os_cputime_timer_relative(&lpclk_settle_tmr,
+ MYNEWT_VAL(MCU_CLOCK_XTAL32K_SETTLE_TIME_MS) * 1000);
+}
diff --git a/hw/mcu/dialog/da1469x/src/hal_system.c b/hw/mcu/dialog/da1469x/src/hal_system.c
index 1e0f722..912d142 100644
--- a/hw/mcu/dialog/da1469x/src/hal_system.c
+++ b/hw/mcu/dialog/da1469x/src/hal_system.c
@@ -30,8 +30,6 @@
static enum hal_reset_reason g_hal_reset_reason;
#endif
-bool g_mcu_lpclk_available;
-
void
hal_system_init(void)
{
@@ -116,23 +114,3 @@ hal_reset_cause(void)
return g_hal_reset_reason;
#endif
}
-
-static void
-da1469x_lpclk_settle_tmr_cb(void *arg)
-{
- da1469x_clock_lp_xtal32k_switch();
-
- g_mcu_lpclk_available = true;
-}
-
-void
-da1469x_lpclk_init(void)
-{
- static struct hal_timer lpclk_settle_tmr;
-
- da1469x_clock_lp_xtal32k_enable();
-
- os_cputime_timer_init(&lpclk_settle_tmr, da1469x_lpclk_settle_tmr_cb, NULL);
- os_cputime_timer_relative(&lpclk_settle_tmr,
- MYNEWT_VAL(MCU_CLOCK_XTAL32K_SETTLE_TIME_MS) * 1000);
-}