i2c: set_frequency now takes a mraa_i2c_mode_t
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -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.
|
* Sets the frequency of the i2c context. Most platforms do not support this.
|
||||||
*
|
*
|
||||||
* @param dev The i2c context
|
* @param dev The i2c context
|
||||||
* @param hz The bus frequency in hertz
|
* @param mode The bus mode
|
||||||
* @return Result of operation
|
* @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
|
* Simple bulk read from an i2c context, this will always begin with the i2c
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ class I2c {
|
|||||||
* the set frequency. Anyone can change this at any time and this will
|
* the set frequency. Anyone can change this at any time and this will
|
||||||
* affect every slave on the bus
|
* 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
|
* @return Result of operation
|
||||||
*/
|
*/
|
||||||
mraa_result_t frequency(int hz) {
|
mraa_result_t frequency(mraa_i2c_mode_t mode) {
|
||||||
return mraa_i2c_frequency(m_i2c, hz);
|
return mraa_i2c_frequency(m_i2c, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -174,6 +174,15 @@ typedef enum {
|
|||||||
MRAA_PIN_UART = 7 /**< UART */
|
MRAA_PIN_UART = 7 /**< UART */
|
||||||
} mraa_pinmodes_t;
|
} 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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ mraa_i2c_init_raw(unsigned int bus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mraa_result_t
|
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;
|
dev->hz = hz;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user