Skip to content
Commit f568673e authored by Alexander Polleti's avatar Alexander Polleti Committed by Anas Nashif
Browse files

c++: Fix compilation of C++ file that includes i2c.h



Within a C++ file I include i2c.h and got 6 of the following errors:

zephyr/include/i2c.h:199:42: error: invalid conversion from
	‘const void*’ to ‘const i2c_driver_api*’ [-fpermissive]
  const struct i2c_driver_api *api = dev->driver_api;
                                     ~~~~~^~~~~~~~~~

I fixed it with a c style conversion for each instance, so
const struct i2c_driver_api *api = dev->driver_api;
becomes

const struct i2c_driver_api *api =
	(const struct i2c_driver_api *)dev->driver_api;

I handled the instances for i2c_slave_driver_api alike.

I tested this with a one of my own boards and communication with a
I2C sensor.

Signed-off-by: default avatarAlexander Polleti <metapsycholo@gmail.com>
parent 72e7bfa6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment