]> granicus.if.org Git - esp-idf/commitdiff
docs: add description of ULP I2C instructions
authorIvan Grokhotkov <ivan@espressif.com>
Thu, 7 Dec 2017 03:50:39 +0000 (11:50 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Mon, 11 Dec 2017 04:11:46 +0000 (12:11 +0800)
docs/api-guides/ulp_instruction_set.rst

index fa280b8b81b5ebeba70444917a40cc5a1693f03b..c4d21947ccf7edc4f8c35c6241a47d9a825df66a 100755 (executable)
@@ -667,6 +667,45 @@ Similar considerations apply to ``LD`` and ``ST`` instructions. Consider the fol
 \r
    1:        ADC      R1, 0, 1      // Measure value using ADC1 pad 2 and store result into R1\r
 \r
+**I2C_RD** - read single byte from I2C slave\r
+----------------------------------------------\r
+\r
+**Syntax**\r
+  - **I2C_RD**   *Sub_addr, High, Low, Slave_sel*\r
+\r
+**Operands**\r
+  - *Sub_addr* – Address within the I2C slave to read.\r
+  - *High*, *Low* — Define range of bits to read. Bits outside of [High, Low] range are masked.\r
+  - *Slave_sel*  -  Index of I2C slave address to use.\r
+\r
+**Description**\r
+  ``I2C_RD`` instruction reads one byte from I2C slave with index ``Slave_sel``. Slave address (in 7-bit format) has to be set in advance into `SENS_I2C_SLAVE_ADDRx` register field, where ``x == Slave_sel``.\r
+  8 bits of read result is stored into `R0` register.\r
+\r
+**Examples**::\r
+\r
+   1:        I2C_RD      0x10, 7, 0, 0      // Read byte from sub-address 0x10 of slave with address set in SENS_I2C_SLAVE_ADDR0\r
+\r
+\r
+**I2C_WR** - write single byte to I2C slave\r
+----------------------------------------------\r
+\r
+**Syntax**\r
+  - **I2C_WR**   *Sub_addr, Value, High, Low, Slave_sel*\r
+\r
+**Operands**\r
+  - *Sub_addr* – Address within the I2C slave to write.\r
+  - *Value* – 8-bit value to be written.\r
+  - *High*, *Low* — Define range of bits to write. Bits outside of [High, Low] range are masked.\r
+  - *Slave_sel*  -  Index of I2C slave address to use.\r
+\r
+**Description**\r
+  ``I2C_WR`` instruction writes one byte to I2C slave with index ``Slave_sel``. Slave address (in 7-bit format) has to be set in advance into `SENS_I2C_SLAVE_ADDRx` register field, where ``x == Slave_sel``.\r
+\r
+**Examples**::\r
+\r
+   1:        I2C_WR      0x20, 0x33, 7, 0, 1      // Write byte 0x33 to sub-address 0x20 of slave with address set in SENS_I2C_SLAVE_ADDR1.\r
+\r
 \r
 **REG_RD** – read from peripheral register\r
 ------------------------------------------\r