Сборка нового проекта. Добавление основных модулей.

This commit is contained in:
cfif 2025-07-11 13:36:32 +03:00
commit 75d936bed0
3 changed files with 68 additions and 0 deletions

17
inc/SystemMutexCmsis.h Normal file
View File

@ -0,0 +1,17 @@
//
// Created by xemon on 26.09.23.
//
#ifndef MOTOTERMINAL_MAIN_ONAT435_SYSTEMMUTEXCMSIS_H
#define MOTOTERMINAL_MAIN_ONAT435_SYSTEMMUTEXCMSIS_H
#include "SystemMutexInterface.h"
#include "cmsis_os.h"
typedef osMutexId_t SystemMutexCmsis;
void SystemMutexCmsis_init(SystemMutexCmsis *env, const osMutexAttr_t *attr);
tSystemMutexInterface SystemMutexCmsis_getInterface(SystemMutexCmsis *env);
#endif //MOTOTERMINAL_MAIN_ONAT435_SYSTEMMUTEXCMSIS_H

22
modular.json Normal file
View File

@ -0,0 +1,22 @@
{
"dep": [
{
"type": "git",
"provider": "HVAC",
"repo": "CmsisRtosInterface"
},
{
"type": "git",
"provider": "HVAC",
"repo": "SystemSyncInterface"
}
],
"cmake": {
"inc_dirs": [
"./inc/"
],
"srcs": [
"./src/**.c"
]
}
}

29
src/SystemMutexCmsis.c Normal file
View File

@ -0,0 +1,29 @@
//
// Created by xemon on 26.09.23.
//
#include <cmsis_os2.h>
#include <SystemMutexInterface.h>
#include "SystemMutexCmsis.h"
void SystemMutexCmsis_init(SystemMutexCmsis *env, const osMutexAttr_t *attr) {
*env = osMutexNew(attr);
}
static bool SystemMutexCmsis_acquire(SystemMutexCmsis *env, int32_t timeout) {
return osMutexAcquire(*env, timeout) == osOK;
}
static bool SystemMutexCmsis_release(SystemMutexCmsis *env, const osMutexAttr_t *attr) {
return osMutexRelease(*env) == osOK;
}
tSystemMutexInterface SystemMutexCmsis_getInterface(SystemMutexCmsis *env) {
return (tSystemMutexInterface) {
.env = env,
.acquire = (void *) SystemMutexCmsis_acquire,
.release = (void *) SystemMutexCmsis_release,
};
}