mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
**New Features** * Runtime font accessors and new symbol fonts for text, launcher, statusbar, and shared icons. * Added font height base setting to device.properties * Text fonts now have 3 sizes: small, default, large **Improvements** * Renamed `UiScale` to `UiDensity` * Statusbar, toolbar and many UI components now compute heights and spacing from fonts/density. * SSD1306 initialization sequence refined for more stable startup. * Multiple image assets replaced by symbol-font rendering. * Many layout improvements related to density, font scaling and icon scaling * Updated folder name capitalization for newer style
85 lines
2.0 KiB
C++
85 lines
2.0 KiB
C++
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
#include <tactility/concurrent/event_group.h>
|
|
#include <tactility/error.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
error_t event_group_set(EventGroupHandle_t eventGroup, uint32_t inFlags) {
|
|
if (xPortInIsrContext() == pdTRUE) {
|
|
BaseType_t yield = pdFALSE;
|
|
if (xEventGroupSetBitsFromISR(eventGroup, inFlags, &yield) == pdFAIL) {
|
|
return ERROR_RESOURCE;
|
|
}
|
|
portYIELD_FROM_ISR(yield);
|
|
} else {
|
|
xEventGroupSetBits(eventGroup, inFlags);
|
|
}
|
|
return ERROR_NONE;
|
|
}
|
|
|
|
error_t event_group_clear(EventGroupHandle_t eventGroup, uint32_t flags) {
|
|
if (xPortInIsrContext() == pdTRUE) {
|
|
if (xEventGroupClearBitsFromISR(eventGroup, flags) == pdFAIL) {
|
|
return ERROR_RESOURCE;
|
|
}
|
|
portYIELD_FROM_ISR(pdTRUE);
|
|
} else {
|
|
xEventGroupClearBits(eventGroup, flags);
|
|
}
|
|
return ERROR_NONE;
|
|
}
|
|
|
|
uint32_t event_group_get(EventGroupHandle_t eventGroup) {
|
|
if (xPortInIsrContext() == pdTRUE) {
|
|
return xEventGroupGetBitsFromISR(eventGroup);
|
|
} else {
|
|
return xEventGroupGetBits(eventGroup);
|
|
}
|
|
}
|
|
|
|
error_t event_group_wait(
|
|
EventGroupHandle_t eventGroup,
|
|
uint32_t inFlags,
|
|
bool awaitAll,
|
|
bool clearOnExit,
|
|
uint32_t* outFlags,
|
|
TickType_t timeout
|
|
) {
|
|
if (xPortInIsrContext() == pdTRUE) {
|
|
return ERROR_ISR_STATUS;
|
|
}
|
|
|
|
uint32_t result_flags = xEventGroupWaitBits(
|
|
eventGroup,
|
|
inFlags,
|
|
clearOnExit ? pdTRUE : pdFALSE,
|
|
awaitAll ? pdTRUE : pdFALSE,
|
|
timeout
|
|
);
|
|
|
|
auto invalid_flags = awaitAll
|
|
? ((inFlags & result_flags) != inFlags) // await all
|
|
: ((inFlags & result_flags) == 0U); // await any
|
|
|
|
if (invalid_flags) {
|
|
const uint32_t matched = inFlags & result_flags;
|
|
if (matched == 0U) {
|
|
return ERROR_TIMEOUT;
|
|
}
|
|
return ERROR_RESOURCE;
|
|
}
|
|
|
|
if (outFlags != nullptr) {
|
|
*outFlags = result_flags;
|
|
}
|
|
|
|
return ERROR_NONE;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|