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;
}
原文地址:https://www.cnblogs.com/wangzhihong-102511/p/10857015.html