typedef union
{
u16 whole;
struct
{
unsigned IMPLEMENTED : 1; /**< Indicates that the key is implemented (from Customer Code to TSL only) */
unsigned ENABLED : 1; /**< Indicates that the key is enabled (from Customer Code to TSL only) */
unsigned DETECTED : 1; /**< Indicates that the key is detected (from TSL to Customer Code only) */
unsigned CHANGED : 1; /**< Indicates that the key state has changed (from TSL to Customer Code only) */
unsigned POSCHANGED : 1; /**< Indicates that the MC key position has changed (from TSL to Customer Code only) */
unsigned ERROR : 1; /**< Indicates that the key has an error (from TSL to Customer Code only) */
unsigned NOISE : 1; /**< Indicates that the key measurement has noise (from TSL to Customer Code only) */
unsigned LOCKED : 1; /**< Reserved (TSL internal usage) */
unsigned DIRECTION : 1; /**< Reserved (TSL internal usage) */
unsigned MCKEY_TYPE : 1; /**< Indicates the type of MCkey: Wheel(0) or Slider(1) (from Customer Code to TSL only) */
unsigned RESERVED0 : 1; /**< Reserved for future use */
unsigned RESERVED1 : 1; /**< Reserved for future use */
unsigned RESERVED2 : 1; /**< Reserved for future use */
unsigned RESERVED3 : 1; /**< Reserved for future use */
unsigned RESERVED4 : 1; /**< Reserved for future use */
unsigned RESERVED5 : 1; /**< Reserved for future use */
} b;
} KeyFlag_T;
我不明白那个:号是做什么用地
http://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
定义结构体的时候,冒号后面跟数字代表占用的bit数。
这个实际上是定义了一个16bit的结构,里面每个bit的作用。