1# i2c_compare_byte 2 3## Description 4Compares a device register to a byte value. Communicates with the device 5directly using the [I2C interface](i2c_interface.md). 6 7## Properties 8| Name | Required | Type | Description | 9| :--- | :------: | :--- | :---------- | 10| register | yes | string | Device register address expressed in hexadecimal. Must be prefixed with 0x and surrounded by double quotes. | 11| value | yes | string | Expected byte value expressed in hexadecimal. Must be prefixed with 0x and surrounded by double quotes. | 12| mask | no | string | Bit mask expressed in hexadecimal. Must be prefixed with 0x and surrounded by double quotes. Specifies which bits should be compared within the byte value. Only the bits with a value of 1 in the mask will be compared. | 13 14## Return Value 15Returns true if the register contained the expected value, otherwise returns 16false. 17 18## Examples 19``` 20{ 21 "comments": [ "Check if register 0xA0 contains 0xFF" ], 22 "i2c_compare_byte": { 23 "register": "0xA0", 24 "value": "0xFF" 25 } 26} 27 28{ 29 "comments": [ "Check if register 0x82 contains 0x40.", 30 "Ignore the most significant bit." ], 31 "i2c_compare_byte": { 32 "register": "0x82", 33 "value": "0x40", 34 "mask": "0x7F" 35 } 36} 37``` 38