📄 os_alarm.h
字号:
#ifndef OS_ALARM_EN
#error "OS_CFG.H, Missing OS_ALARM_EN: Include code for OSAlarm*()"
#endif
#if (OS_ALARM_EN > 0) && (OS_MAX_ALARMS > 0)
#if (OS_VERSION < 251)
#error "OS_ALARM requires uCOS-II version 2.52 at least"
#endif
#ifdef OS_ALARM_GLOBALS
#define OS_ALARM_EXT
#else
#define OS_ALARM_EXT extern
#endif
typedef struct {
/** the type and state of this alarm */
INT8U OSAlarmType;
/** the absolute time in ticks when this alarm triggers */
INT32U OSAlarmTime;
#if (OS_ALARM_PERIODIC_EN > 0)
/** The number of ticks in a period. If this is > 0,
* this is a periodic alarm, reset after each trigger.
*/
INT16U OSAlarmPeriod;
#endif
/** next alarm in free/active list */
void *OSAlarmNext;
/** event flag group to trigger */
OS_FLAG_GRP *OSAlarmFlagGrp;
/** event flags to set on trigger */
OS_FLAGS OSAlarmFlags;
} OS_ALARM;
/// Table containing alarms
OS_ALARM_EXT OS_ALARM OSAlarmTbl[OS_MAX_ALARMS];
/// Pointer to list of free alarms
OS_ALARM_EXT OS_ALARM *OSAlarmFreeList;
/// Pointer to list of active alarms
OS_ALARM_EXT OS_ALARM *OSAlarmActiveList;
/// alarm is free
#define OS_ALARM_TYPE_UNUSED 20
/// alarm is allocated but idle
#define OS_ALARM_TYPE_IDLE 21
/// alarm is active
#define OS_ALARM_TYPE_ACTIVE 22
/// one-shot alarm option
#define OS_ALARM_ONESHOT 0
/// period alarm option
#define OS_ALARM_PERIODIC 1
/// indicates that an alarm could not be allocated
#define OS_ALARM_DEPLETED 160
/// indicates that a wrong alarm state was present in OSAlarm*()
#define OS_ERR_ALARM_TYPE 161
void OSAlarmInit(void);
OS_ALARM *OSAlarmCreate(OS_FLAG_GRP *flag_group, OS_FLAGS flags, INT8U opt, INT8U *err);
void OSAlarmDel(OS_ALARM *alarm, INT8U *err);
void OSAlarmDisable(OS_ALARM *alarm, INT8U *err);
void OSAlarmSet(OS_ALARM *alarm, INT16U ticks, INT8U *err);
INT8U OSAlarmCheck(void);
void OSAlarmTrigger(void);
#endif /* OS_ALARMS_EN */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -