clang-format: run clang-format on C/C++ code
[contrib/mraa.git] / api / mraa / i2c.h
index a98b021..69f1022 100644 (file)
@@ -61,7 +61,7 @@ typedef struct _i2c* mraa_i2c_context;
 mraa_i2c_context mraa_i2c_init(int bus);
 
 /**
- * Initialise i2c context, passing in spi bus to use.
+ * Initialise i2c context, passing in the i2c bus to use.
  *
  * @param bus The i2c bus to use i.e. /dev/i2c-2 would be "2"
  * @return i2c context or NULL
@@ -72,10 +72,10 @@ mraa_i2c_context mraa_i2c_init_raw(unsigned int bus);
  * Sets the frequency of the i2c context. Most platforms do not support this.
  *
  * @param dev The i2c context
- * @param hz The bus frequency in hertz
+ * @param mode The bus mode
  * @return Result of operation
  */
-mraa_result_t mraa_i2c_frequency(mraa_i2c_context dev, int hz);
+mraa_result_t mraa_i2c_frequency(mraa_i2c_context dev, mraa_i2c_mode_t mode);
 
 /**
  * Simple bulk read from an i2c context, this will always begin with the i2c
@@ -86,7 +86,7 @@ mraa_result_t mraa_i2c_frequency(mraa_i2c_context dev, int hz);
  * @param length max number of bytes to read
  * @return length of the read in bytes or 0
  */
-int mraa_i2c_read(mraa_i2c_context dev, uint8_t *data, int length);
+int mraa_i2c_read(mraa_i2c_context dev, uint8_tdata, int length);
 
 /**
  * Simple read for a single byte from the i2c context, this will always begin
@@ -116,6 +116,17 @@ uint8_t mraa_i2c_read_byte_data(mraa_i2c_context dev, const uint8_t command);
 uint16_t mraa_i2c_read_word_data(mraa_i2c_context dev, const uint8_t command);
 
 /**
+ * Bulk read from i2c context, starting from designated register
+ *
+ * @param dev The i2c context
+ * @param command The register
+ * @param data pointer to the byte array to read data in to
+ * @param length max number of bytes to read
+ * @return The length in bytes passed to the function or 0
+ */
+int mraa_i2c_read_bytes_data(mraa_i2c_context dev, uint8_t command, uint8_t* data, int length);
+
+/**
  * Write length bytes to the bus, the first byte in the array is the
  * command/register to write
  *
@@ -124,7 +135,7 @@ uint16_t mraa_i2c_read_word_data(mraa_i2c_context dev, const uint8_t command);
  * @param length the number of bytes to transmit
  * @return Result of operation
  */
-mraa_result_t mraa_i2c_write(mraa_i2c_context dev, const uint8_t *data, int length);
+mraa_result_t mraa_i2c_write(mraa_i2c_context dev, const uint8_tdata, int length);
 
 /**
  * Write a single byte to an i2c context, always at offset 0x0