mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
* **New Features** * Added a HAL device module providing device enumeration, type queries and a HAL↔kernel bridge. * **Improvements** * Integrated HAL module into startup; standardized module names, includes and lifecycle logging; safer file append behavior; broader build support. * **API Changes** * Driver lifecycle now uses explicit add/remove semantics; C and HAL device type/lookup APIs clarified. * **Chores** * Added module README and Apache‑2.0 license; updated build configuration to include the new module. * **Fixes** * Updated tests and object file handling to behave correctly.
66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
#define DOCTEST_CONFIG_IMPLEMENT
|
|
#include "doctest.h"
|
|
#include <cassert>
|
|
|
|
#include <tactility/freertos/task.h>
|
|
#include <tactility/kernel_init.h>
|
|
|
|
typedef struct {
|
|
int argc;
|
|
char** argv;
|
|
int result;
|
|
} TestTaskData;
|
|
|
|
extern "C" {
|
|
// From the relevant platform
|
|
extern struct Module platform_module;
|
|
}
|
|
|
|
void test_task(void* parameter) {
|
|
auto* data = (TestTaskData*)parameter;
|
|
|
|
doctest::Context context;
|
|
|
|
context.applyCommandLine(data->argc, data->argv);
|
|
|
|
// overrides
|
|
context.setOption("no-breaks", true); // don't break in the debugger when assertions fail
|
|
|
|
check(kernel_init(&platform_module, nullptr, nullptr) == ERROR_NONE);
|
|
|
|
data->result = context.run();
|
|
|
|
vTaskEndScheduler();
|
|
|
|
vTaskDelete(nullptr);
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
TestTaskData data = {
|
|
.argc = argc,
|
|
.argv = argv,
|
|
.result = 0
|
|
};
|
|
|
|
BaseType_t task_result = xTaskCreate(
|
|
test_task,
|
|
"test_task",
|
|
8192,
|
|
&data,
|
|
1,
|
|
nullptr
|
|
);
|
|
assert(task_result == pdPASS);
|
|
|
|
vTaskStartScheduler();
|
|
|
|
return data.result;
|
|
}
|
|
|
|
extern "C" {
|
|
// Required for FreeRTOS
|
|
void vAssertCalled(unsigned long line, const char* const file) {
|
|
__assert_fail("assert failed", file, line, "");
|
|
}
|
|
}
|