Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit ede4509

Browse files
Jimmy Huanggrgustaf
authored andcommitted
[i2c] Update I2C configure type (#1808)
The current I2C configure function uses a deprecated I2C struct, with Zephyr 1.10, this is no longer valid and needs to updated to use new type. Fixes #1807 Signed-off-by: Jimmy Huang <[email protected]>
1 parent faded1e commit ede4509

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/zjs_i2c_handler.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016-2017, Intel Corporation.
1+
// Copyright (c) 2016-2018, Intel Corporation.
22

33
// ZJS includes
44
#include "zjs_i2c_handler.h"
@@ -27,14 +27,9 @@ int zjs_i2c_handle_open(u8_t msg_bus)
2727
if (!i2c_device[msg_bus]) {
2828
ERR_PRINT("I2C bus %s not found.\n", bus);
2929
} else {
30-
/* TODO remove these hard coded numbers
31-
* once the config API is made */
32-
union dev_config cfg;
33-
cfg.raw = 0;
34-
cfg.bits.use_10_bit_addr = 0;
35-
cfg.bits.speed = I2C_SPEED_STANDARD;
36-
cfg.bits.is_master_device = 1;
37-
error_code = i2c_configure(i2c_device[msg_bus], cfg.raw);
30+
u32_t cfg;
31+
cfg = I2C_SPEED_SET(I2C_SPEED_STANDARD) | I2C_MODE_MASTER;
32+
error_code = i2c_configure(i2c_device[msg_bus], cfg);
3833

3934
if (error_code != 0) {
4035
ERR_PRINT("I2C bus %s configure failed with %i.\n", bus,

0 commit comments

Comments
 (0)