From 1d0f82b3fc17616c8c3aee4bf13837ba7b4d72db Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Sat, 27 Jul 2019 13:17:11 +0200
Subject: [PATCH] refactor(mod-pmic): Use card10_reset() instead of manual impl

Commit 82b5b21f007f112ea96599ed031de63692aa6120 intoduced
card10_reset().  This patch refactors the pmic module to also make use
of this new implementation.

Signed-off-by: Rahix <rahix@rahix.de>
---
 epicardium/modules/pmic.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/epicardium/modules/pmic.c b/epicardium/modules/pmic.c
index 045b009a..a41b38aa 100644
--- a/epicardium/modules/pmic.c
+++ b/epicardium/modules/pmic.c
@@ -4,6 +4,7 @@
 #include "gcr_regs.h"
 #include "pmic.h"
 #include "MAX77650-Arduino-Library.h"
+#include "card10.h"
 
 #include "FreeRTOS.h"
 #include "task.h"
@@ -52,15 +53,7 @@ void vPmicTask(void *pvParameters)
 		if (int_flag & MAX77650_INT_nEN_R) {
 			/* Button was pressed */
 			if (count < PMIC_PRESS_SLEEP) {
-				LOG_INFO("pmic", "Reset");
-				/*
-				 * Give the UART fifo time to clear.
-				 * TODO: Do this properly
-				 */
-				for (int i = 0; i < 0x1000000; i++) {
-					__asm volatile("nop");
-				}
-				MXC_GCR->rstr0 = MXC_F_GCR_RSTR0_SYSTEM;
+				card10_reset();
 			}
 
 			count = 0;
-- 
GitLab