129decbeeSShawn McCarney# i2c_compare_byte
229decbeeSShawn McCarney
329decbeeSShawn McCarney## Description
4*0dbce568SPatrick Williams
529decbeeSShawn McCarneyCompares a device register to a byte value. Communicates with the device
629decbeeSShawn McCarneydirectly using the [I2C interface](i2c_interface.md).
729decbeeSShawn McCarney
829decbeeSShawn McCarney## Properties
9*0dbce568SPatrick Williams
1029decbeeSShawn McCarney| Name     | Required | Type   | Description                                                                                                                                                                                                               |
11*0dbce568SPatrick Williams| :------- | :------: | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1229decbeeSShawn McCarney| register |   yes    | string | Device register address expressed in hexadecimal. Must be prefixed with 0x and surrounded by double quotes.                                                                                                               |
1329decbeeSShawn McCarney| value    |   yes    | string | Expected byte value expressed in hexadecimal. Must be prefixed with 0x and surrounded by double quotes.                                                                                                                   |
1429decbeeSShawn McCarney| 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. |
1529decbeeSShawn McCarney
1629decbeeSShawn McCarney## Return Value
17*0dbce568SPatrick Williams
1829decbeeSShawn McCarneyReturns true if the register contained the expected value, otherwise returns
1929decbeeSShawn McCarneyfalse.
2029decbeeSShawn McCarney
2129decbeeSShawn McCarney## Examples
22*0dbce568SPatrick Williams
2329decbeeSShawn McCarney```
2429decbeeSShawn McCarney{
2529decbeeSShawn McCarney  "comments": [ "Check if register 0xA0 contains 0xFF" ],
2629decbeeSShawn McCarney  "i2c_compare_byte": {
2729decbeeSShawn McCarney    "register": "0xA0",
2829decbeeSShawn McCarney    "value": "0xFF"
2929decbeeSShawn McCarney  }
3029decbeeSShawn McCarney}
3129decbeeSShawn McCarney
3229decbeeSShawn McCarney{
3329decbeeSShawn McCarney  "comments": [ "Check if register 0x82 contains 0x40.",
3429decbeeSShawn McCarney                "Ignore the most significant bit." ],
3529decbeeSShawn McCarney  "i2c_compare_byte": {
3629decbeeSShawn McCarney    "register": "0x82",
3729decbeeSShawn McCarney    "value": "0x40",
3829decbeeSShawn McCarney    "mask": "0x7F"
3929decbeeSShawn McCarney  }
4029decbeeSShawn McCarney}
4129decbeeSShawn McCarney```
42