# Bridge 1.1 API - I2C Commands

### Set Bus Voltage

* **Command Request:**

  ```json
  {
    "transaction_id": "1",
    "command": "i2c_spi_uart_set_bus_voltage",
    "params": {
      "busVoltageInV": "<Float>"
    }
  }
  ```
* **Responses:**
  * Immediate Promise Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": true,
      "data": {
        "command": "i2c_spi_uart_set_bus_voltage"
      }
    }
    ```
  * Final Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": false,
      "data": {
        "is_response_to": "i2c_spi_uart_set_bus_voltage",
        "status": "success"
      }
    }
    ```

### I2C Set Parameters

* **Command Request:**

  ```json
  {
    "transaction_id": "1",
    "command": "i2c_set_parameters",
    "params": {
      "clockFrequencyInKHz": "<Unsigned Int>"
    }
  }
  ```
* **Responses:**
  * Immediate Promise Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": true,
      "data": {
        "command": "i2c_set_parameters"
      }
    }
    ```
  * Final Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": false,
      "data": {
        "is_response_to": "i2c_set_parameters",
        "status": "success"
      }
    }
    ```

### I2C Read

* **Command Request:**

  ```json
  {
    "transaction_id": "1",
    "command": "i2c_read",
    "params": {
      "address": "<2-Digit Hexadecimal (E.g. 0A)>",
      "bytesToRead": "<Unsigned Integer>",
      "busVoltageInV": "<Float>"
      }
    }
  }
  ```
* **Responses:**
  * Immediate Promise Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": true,
      "data": {
        "command": "i2c_read"
      }
    }
    ```
  * Final Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": false,
      "data": {
        "is_response_to": "i2c_read",
        "status": "success",
        "data": <Array of 2-Digit Hex (E.g. ["DE", "AD", "BE", "EF"])>
      }
    }
    ```

### I2C Write

* **Command Request:**

  ```json
  {
    "transaction_id": "1",
    "command": "i2c_write",
    "params": {
      "address": "<2-Digit Hexadecimal (E.g. 0A)>",
      "writeBuffer": "<Hexadecimal String (E.g. DEADBEEF, A1B3C3D4F5)>",
      "clockFrequencyInKHz": "Unsigned Integer"
    }
  }
  ```
* **Responses:**
  * Immediate Promise Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": true,
      "data": {
        "command": "i2c_write"
      }
    }
    ```
  * Final Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": false,
      "data": {
        "is_response_to": "i2c_write",
        "status": "success"
      }
    }
    ```

### I2C Read Using Subaddress

* **Command Request:**

  ```json
  {
    "transaction_id": "1",
    "command": "i2c_read_using_subaddress",
    "params": {
      "address": "<2-Digit Hexadecimal (E.g. 0A)>",
      "subaddress": "<Unsigned Integer (E.g. 0001)>",
      "bytesToRead": "<Unsigned Integer>",
      "busVoltageInV": "<Float>"
      }
    }
  }
  ```
* **Responses:**
  * Immediate Promise Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": true,
      "data": {
        "command": "i2c_read_using_subaddress"
      }
    }
    ```
  * Final Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": false,
      "data": {
        "is_response_to": "i2c_read_using_subaddress",
        "status": "success",
        "data": <Array of 2-Digit Hex (E.g. ["DE", "AD", "BE", "EF"])>
      }
    }
    ```

### I2C Write Using Subaddress

* **Command Request:**

  ```json
  {
    "transaction_id": "1",
    "command": "i2c_write_using_subaddress",
    "params": {
      "address": "<2-Digit Hexadecimal (E.g. 0A)>",
      "subaddress": "<Unsigned Integer (E.g. 0001)>",
      "writeBuffer": "<Hexadecimal String (E.g. DEADBEEF, A1B3C3D4F5)>",
      "clockFrequencyInKHz": "Unsigned Integer"
    }
  }
  ```
* **Responses:**
  * Immediate Promise Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": true,
      "data": {
        "command": "i2c_write_using_subaddress"
      }
    }
    ```
  * Final Response:

    ```json
    {
      "transaction_id": "1",
      "status": "success",
      "type": "command_response",
      "is_promise": false,
      "data": {
        "is_response_to": "i2c_write_using_subaddress",
        "status": "success"
      }
    }
    ```
