1# i2c_compare_bit
2
3## Description
4
5Compares a bit in a device register to a 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| position |   yes    | number | Bit position value from 0-7. Bit 0 is the least significant bit.                                            |
14| value    |   yes    | number | Expected bit value: 0 or 1.                                                                                 |
15
16## Return Value
17
18Returns true if the register bit contained the expected value, otherwise returns
19false.
20
21## Example
22
23```json
24{
25  "comments": ["Check if bit 3 is on in register 0xA0"],
26  "i2c_compare_bit": {
27    "register": "0xA0",
28    "position": 3,
29    "value": 1
30  }
31}
32```
33