Skip to content

Commit 6102147

Browse files
kltsengAnas Nashif
authored andcommitted
samples: i2c_fujitsu: change hard-coded device name
Change to use the device config name defined by driver's Kconfig for device binding, instead of hard-coding it which is not portable. Jira: ZEP-1764 Change-Id: I61ed7cfd97e20faad8f1e98dacef9384e8fefc73 Signed-off-by: Kuo-Lang Tseng <[email protected]> (cherry picked from commit 4a363ff)
1 parent 5ea4f57 commit 6102147

File tree

1 file changed

+7
-1
lines changed
  • samples/drivers/i2c_fujitsu_fram/src

1 file changed

+7
-1
lines changed

samples/drivers/i2c_fujitsu_fram/src/main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
#include <device.h>
1111
#include <i2c.h>
1212

13+
#if defined(CONFIG_SOC_QUARK_SE_C1000_SS)
14+
#define I2C_DEV CONFIG_I2C_SS_0_NAME
15+
#else
16+
#define I2C_DEV CONFIG_I2C_0_NAME
17+
#endif
18+
1319
/**
1420
* @file Sample app using the Fujitsu MB85RC256V FRAM through ARC I2C.
1521
*/
@@ -75,7 +81,7 @@ void main(void)
7581
uint8_t data[16];
7682
int i, ret;
7783

78-
i2c_dev = device_get_binding("I2C_0");
84+
i2c_dev = device_get_binding(I2C_DEV);
7985
if (!i2c_dev) {
8086
printk("I2C: Device driver not found.\n");
8187
return;

0 commit comments

Comments
 (0)