如何节约操作内存()

如何节约操作内存? 1:直接操作一个字节
#define SYS_FLAG_TAMPER_ALARM (1<<0)//
#define SYS_FLAG_ARMING_ALARM (1<<1)//
#define SYS_FLAG_ARMING_STATUS (1<<2)//
#define SYS_FLAG_ANTI_LOCK_STATUS (1<<3)//
#define SYS_FLAG_MECH_KEY_ALARM (1<<4)//


void NvMan_SetSysFlag(uint8_t flag, FlagStatus sta)
{
uint8_t flagValue;

EEPROM_ReadMultiBytes((uint32_t)&(NV_DATA->sysParam.flag), &flagValue, 1);
if (sta == SET)
{
flagValue |= flag;
}
else
{
flagValue &= ~(flag);
}
EEPROM_WriteMultiBytes((uint32_t)&(NV_DATA->sysParam.flag), &flagValue, 1);
}

读取对应标志。防撬报警标志 布防报警标志 布防状态 反锁状态 传入对应参数,返回0或1
FlagStatus NvMan_GetSysFlag(uint8_t flag)
{
uint8_t flagValue;

EEPROM_ReadMultiBytes((uint32_t)&(NV_DATA->sysParam.flag), &flagValue, 1);
return (flagValue & flag) ? SET : RESET;
}
posted on 2019-05-13 15:44江红之乡 阅读( ...) 评论( ...) 编辑 收藏 【如何节约操作内存()】转载于:https://www.cnblogs.com/wangzhihong-102511/p/10857015.html

    推荐阅读