嵌入式爱好者

可变参数函数

2023-2-28 17:08| 发布者: snn| 查看: 161| 评论: 0

类目: i.MX8MP系列产品  >  Linux     文档编号: 943

可变参数函数又称参数个数可变函数(本文也简称变参函数),即函数参数数目可变。
函数示例

1.

#define dcs_write_seq(dev, seq...)                            \

({                                                      \

       static const u8 d[] = { seq };                      \

       otm8009a_dcs_write_buf(dev, d, ARRAY_SIZE(d));           \

})


2.

#define dcs_write_cmd_at(dev, cmd, seq...)              \

({                                               \

       static const u16 c = cmd;                   \

       struct udevice *device = dev;                    \

       dcs_write_seq(device, MCS_ADRSFT, c);     \

       dcs_write_seq(device, c, seq);             \

})

3.
dcs_write_cmd_at(dev,MCS_PANSET,0xFF,0x83,0x94 );
seq... 传入了所有参数,但是定义时只用了aeq...

已解决

未解决

只是看看

最新评论

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-11-8 20:54

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部