在 FreeRTOS 中,变量名的前缀(perfixes)遵循严格的匈牙利命名法(Hungarian-style naming convention).

px Prefix Breakdown

PrefixMeaningExampleTypical Type
ppointerpucBufferpointer to something (void *, uint8_t *, etc.)
pxpointer to a structure (type name starts with x)pxNext, pxItem, pxListpointer to a struct like xList, xListItem, etc.
xstructure (not a pointer)xList, xEventGroupstructure itself (not a pointer)
vfunction returns voidvTaskDelay()indicates no return value
uxunsigned integeruxNumberOfTaskstype: UBaseType_t (unsigned)
ccharcStatuschar
ucunsigned char / uint8_tucPriorityuint8_t
bbooleanbFlagtypically BaseType_t or bool
pvpointer to voidpvParameters, pvOwnervoid *

参考官网:Naming Conventions

标签: none

评论已关闭