Kubos Linux I2C API¶
The kubos-hal-linux
module is the Kubos HAL implementation for devices running Kubos Linux.
This module sits as a proxy layer between the Kubos HAL C interface the Linux sysfs.
-
int
hal_i2c_bus
[K_NUM_I2CS]¶ Static array of I2C bus file descriptors.
-
KI2CStatus
kprv_i2c_dev_init
(KI2CNum i2c)¶ Low level hal device initialization.
- Return
- KI2CStatus I2C_OK on success, I2C_ERROR_* on error
- Parameters
i2c
: I2C bus to initialize
-
KI2CStatus
kprv_i2c_dev_terminate
(KI2CNum i2c)¶ Low level HAL I2C termination.
- Return
- KI2CStatus I2C_OK on success, I2C_ERROR on error
- Parameters
i2c
: I2C bus to terminate
-
KI2CStatus
kprv_i2c_master_write
(KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)¶ Low level HAL I2C write (as master)
- Return
- KI2CStatus I2C_OK on success, I2C_ERROR on error
- Parameters
i2c
: I2C bus to write fromaddr
: I2C addr to write toptr
: data bufferlen
: length of data in buffer
-
KI2CStatus
kprv_i2c_master_read
(KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)¶ Low level HAL I2C read (as master) This is implemented by the device specific hal.
- Return
- KI2CStatus I2C_OK on success, I2C_ERROR on error
- Parameters
i2c
: I2C bus to read fromaddr
: I2C addr to read fromptr
: data bufferlen
: length of data expected to read
-
KI2CStatus
kprv_i2c_slave_write
(KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)¶ Low level HAL I2C write (as slave)
- Warning
- Not currently implemented
- Return
- KI2CStatus I2C_OK on success, I2C_ERROR on error
- Parameters
i2c
: I2C bus to write fromaddr
: I2C addr to write toptr
: data bufferlen
: length of data in buffer
-
KI2CStatus
kprv_i2c_slave_read
(KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)¶ Low level HAL I2C read (as slave)
- Warning
- Not currently implemented
- Return
- KI2CStatus I2C_OK on success, I2C_ERROR on error
- Parameters
i2c
: I2C bus to read fromaddr
: I2C addr to read fromptr
: data bufferlen
: length of data expected to read
-
STRINGIFY
(s)¶ Convert constant to string value.