我有一组操作码来执行特定功能,但棘手的部分在这里:例如在下面发布的代码中,channelABC 是输入,这意味着:如果在我的产品端有通道 A,或通道 b,或通道 c 是选择,它应该匹配,或者,如果在我的产品方面。如果选择了通道 b 和 c,它应该匹配,基本上如果一个或多个通道匹配(输入侧或产品侧),- Led 必须发光。
我试图映射它,但我不确定正确的方法
typedef enum{
ZoneA = 0x01,
ZoneB = 0x02,
ZoneC = 0x04,
ZoneD = 0x08,
zoneE = 0x10,
ZoneF = 0x20,
ZoneG = 0x40,
ZoneH = 0x80,
ZoneABCD = 0x0f,
ZoneAB = 0x03,
ZoneAC = 0x05,
ZoneAD = 0x09,
ZoneBC = 0x06,
ZoneBD = 0x0A,
ZoneCD = 0x0C,
ZoneABC = 0x07 ,
ZoneABD = 0x0B,
ZoneBCD = 0x0E,
NOZONE = 0x00
}zone;
railzone =buffers[0]; //rail zone read the value , which is the first element in the buffer when the packet info is transformed to buffer
//railzone will have the input here
if(railzone ==ZoneABCD || railzone == ZoneA || railzone == ZoneB || railzone == ZoneC || railzone == ZoneD || railzone == ZoneAB
|| railzone == ZoneAC || railzone == ZoneAD || railzone == ZoneBC || railzone == ZoneBD || railzone == ZoneCD || railzone == ZoneABC ||
railzone == ZoneABD || railzone == ZoneBCD )
{
}
我作为 ZONEABC 提供输入,并且我的产品中有 zoneAB,并且由于 zoneA 和 b 中的两个存在,它应该会点亮 LED