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