From a31bc4e78056b085e5f5e34e3238ddd2f2ad7ab5 Mon Sep 17 00:00:00 2001
From: swym <0xfd000000@gmail.com>
Date: Sat, 24 Aug 2019 17:51:35 +0200
Subject: [PATCH] use xPoortIsInsideInterrupt instead of raw register access

---
 epicardium/fs/filesystem_fat.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/epicardium/fs/filesystem_fat.c b/epicardium/fs/filesystem_fat.c
index 2f513b76..ccaec621 100644
--- a/epicardium/fs/filesystem_fat.c
+++ b/epicardium/fs/filesystem_fat.c
@@ -25,7 +25,6 @@
 #include "modules/log.h"
 #include "modules/modules.h"
 #include "api/common.h"
-#include "core_cmFunc.h" //__get_IPSR()
 
 #define SSLOG_DEBUG(...) LOG_DEBUG("fatfs", __VA_ARGS__)
 #define SSLOG_INFO(...) LOG_INFO("fatfs", __VA_ARGS__)
@@ -169,11 +168,11 @@ int fatfs_attach()
 void fatfs_schedule_attach(void)
 {
 	//if we're running in thread context, cont't call the *FromISR version
-	if (__get_IPSR() == 0) {
+	if (xPortIsInsideInterrupt()) {
+		xTimerPendFunctionCallFromISR(cb_attachTimer, NULL, 0, NULL);
+	} else {
 		xTimerPendFunctionCall(
 			cb_attachTimer, NULL, 0, 1); //wait 1 tick
-	} else {
-		xTimerPendFunctionCallFromISR(cb_attachTimer, NULL, 0, NULL);
 	}
 }
 
-- 
GitLab