* 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
* the set frequency. Anyone can change this at any time and this will
* affect every slave on the bus
*
- * @param hz Frequency to set the bus to in hz
+ * @param mode Frequency to set the bus to
* @return Result of operation
*/
- mraa_result_t frequency(int hz) {
- return mraa_i2c_frequency(m_i2c, hz);
+ mraa_result_t frequency(mraa_i2c_mode_t mode) {
+ return mraa_i2c_frequency(m_i2c, mode);
}
/**
MRAA_PIN_UART = 7 /**< UART */
} mraa_pinmodes_t;
+/**
+ * Enum reprensenting different i2c speeds/modes
+ */
+typedef enum {
+ MRAA_I2C_STD = 0, /**< up to 100Khz */
+ MRAA_I2C_FAST = 1, /**< up to 400Khz */
+ MRAA_I2C_HIGH = 2 /**< up to 3.4Mhz */
+} mraa_i2c_mode_t;
+
#ifdef __cplusplus
}
#endif
}
mraa_result_t
-mraa_i2c_frequency(mraa_i2c_context dev, int hz)
+mraa_i2c_frequency(mraa_i2c_context dev, mraa_i2c_mode_t mode)
{
dev->hz = hz;