Skip to content

Commit

Permalink
Edit MINI macro to MINI_AB to calculate the two digital numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
At-EC committed Jun 8, 2024
1 parent 6ff22e8 commit 3693c51
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
File renamed without changes
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [At-RTOS](https://github.com/At-EC/At-RTOS) &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/At-EC/At-RTOS/blob/main/LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/At-EC/At-RTOS/tree/main/.github/Welcome_PRs.md) <a href="https://github.com/At-EC/At-RTOS/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/At-EC/At-RTOS?color=success"></a> [![Discord](https://img.shields.io/discord/1208405601994932274?logo=discord)](https://discord.gg/AxfF9aH58G) <a href="https://github.com/At-EC/At-RTOS/actions"><img alt="Build" src="https://github.com/At-EC/At-RTOS/workflows/Build/badge.svg"></a> [![GitHub Release](https://img.shields.io/github/v/release/At-EC/At-RTOS)](./release-note.md)
# <img src="https://github.com/At-EC/At-FSM/blob/main/.github/picture/@-EC.png" alt="@-EC" width="25" height="25" /> [At-RTOS](https://github.com/At-EC/At-RTOS) &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/At-EC/At-RTOS/blob/main/LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/At-EC/At-RTOS/tree/main/.github/Welcome_PRs.md) <a href="https://github.com/At-EC/At-RTOS/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/At-EC/At-RTOS?color=success"></a> [![Discord](https://img.shields.io/discord/1208405601994932274?logo=discord)](https://discord.gg/AxfF9aH58G) <a href="https://github.com/At-EC/At-RTOS/actions"><img alt="Build" src="https://github.com/At-EC/At-RTOS/workflows/Build/badge.svg"></a> [![GitHub Release](https://img.shields.io/github/v/release/At-EC/At-RTOS)](./release-note.md)

At-RTOS([@ Real-Time Operating System](https://github.com/At-EC/At-RTOS)) is an open and user-friendly Real-Time Operating System(RTOS) designed for various embedded controllers' supporting, as it's beginning it will be an important member of the At-EC family.

Expand Down
4 changes: 2 additions & 2 deletions include/kernel/typedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ typedef u32_t u32p_t;
#define SIZEOF(arr) (sizeof(arr))
#define DIMOF(arr) (SIZEOF(arr) / SIZEOF(arr[0]))

#define MINI(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MINI_AB(a, b) (((a) < (b)) ? (a) : (b))
#define MAX_AB(a, b) (((a) > (b)) ? (a) : (b))

#define ROUND_UP(size, align) (((u32_t)(size) + (align - 1u)) & (~(align - 1)))
#define ROUND_DOWN(size, align) (((u32_t)(size)) & (~(align - 1)))
Expand Down
4 changes: 2 additions & 2 deletions kernel/subscribe.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static u32_t _publish_data_submit_privilege_routine(arguments_t *pArgs)
subscribe_context_t *pCurSubscribe = NULL;
while (list_iterator_next_condition(&it, (void *)&pCurSubscribe)) {
os_memcpy((u8_t *)pCurSubscribe->callEntry.pDataAddress, (const u8_t *)pPublishData,
MINI(publishSize, pCurSubscribe->callEntry.dataSize));
MINI_AB(publishSize, pCurSubscribe->callEntry.dataSize));

if ((!pCurSubscribe->isMute) && (pCurSubscribe->callEntry.pNotificationHandler)) {
list_t *pListPending = (list_t *)_publish_list_pendingHeadGet();
Expand Down Expand Up @@ -386,7 +386,7 @@ static u32_t _subscribe_apply_data_privilege_routine(arguments_t *pArgs)
publish_context_t *pCurPublish = _publish_object_contextGet(pCurSubscribe->hold);

if (pCurSubscribe->last_count < pCurPublish->refresh_count) {
*pDataLen = MINI(*pDataLen, pCurSubscribe->callEntry.dataSize);
*pDataLen = MINI_AB(*pDataLen, pCurSubscribe->callEntry.dataSize);
os_memcpy(pDataBuffer, pCurSubscribe->callEntry.pDataAddress, *pDataLen);
pCurSubscribe->last_count = pCurPublish->refresh_count;

Expand Down

0 comments on commit 3693c51

Please sign in to comment.