雷竞技电竞平台Dialog Semiconductor客户支持-宏MS_TO_TIMERUNITS https://support.dialog-semiconductor.com/resource-keywords/macro-mstotimerunits-timerunitstoms 危险宏定义:MS_TO_BLESLOTS, MS_TO_DOUBLESLOTS, MS_TO_TIMERUNITS, TIMERUNITS_TO_MS… https://support.dialog-semiconductor.com/dangerous-macro-definitions-mstobleslots-mstodoubleslots-mstotimerunits-timerunitstoms < div class = "字段field-name-taxonomy-forums field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >论坛:,< / div > < div class = "字段条目" > < div class =”field-item甚至“rel = " sioc: has_container " > < a href = " /论坛/ dialog-smartbond-bluetooth-low-energy - % E2 % 80% 93 -软件”“=“sioc:容器sioc:论坛”property="rdfs:label skos:prefLabel" datatype="">Dialog Smartbond Bluetooth Low Energy - Software

Ms_to_bleslots, ms_to_doubleslots, ms_to_timerunits, timerunits_to_ms, us_to_bleslots, us_to_doubleslots, us_to_timerunits。

对于使用这些宏的人,请注意它们不应该与公式一起使用。< br / >为例,看看MS_TO_TIMERUNITS: < br / > <代码> # define MS_TO_TIMERUNITS (x) ((int) (x / 10)) < /代码> < br / >没关系做<代码> MS_TO_TIMERUNITS(10000) < /代码>和<代码> MS_TI_TIMERUNITS (x) < /代码> < br / >, <代码> MS_TO_TIMERUNITS (a + b) > < /代码会给:<代码> ((int) (a + b / 10)) < /代码> < br / > <代码> ((int) ((a + b) / 10)) > < /代码! !

一个简单的修复-在宏定义中用括号包装x:
#define MS_TO_TIMERUNITS(x) ((int)((x)/10))
(其他宏也一样)。

我们正在使用DA1458x_SDK 5.0.3。< / p > < / div > < / div > < / div > < div class =”字段field-name-field-forum-keywords field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >关键词:,< / div > < div class = "字段条目" > < div class =”field-item甚至“> < a href = " / resource-keywords / macro-mstotimerunits-timerunitstoms”“=“skos:概念”属性=“rdfs: label skos: prefLabel”datatype="">macro MS_TO_TIMERUNITS TIMERUNITS_TO_MS

Device: 
星期三,2016年6月29日15:46:59 +0000 奥伦 4053年https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/dangerous-macro-definitions-mstobleslots-mstodoubleslots-mstotimerunits-timerunitstoms#comments