How to initilize the i2c and GPIO - Raspberry Pi Forums
hello pal,
interfacing touch screen pi, same driver in kernel. need initialize of platform data driver work, below have given example code ti's processor other information data sheet below-
platform data
initialise driver, code must added platform initialisation code to
configure i2c address , interrupt (chg) line.
in board files under relevant architecture , platform tree within
linux kernel directory. instance, arch/arm/mach-omap2/.
following structures initialise irq type , i2c address:
static struct mxt_platform_data mxt_data = {
.irqflags = irqf_trigger_falling | irqf_oneshot,
};
static struct i2c_board_info __initdata i2c2boardinfo[] = {
{
i2c_board_info("atmel_mxt_ts", 0x4b), /* i2c address */
.platform_data = &mxt_data,
},
};
these lines added init function initialise gpio chg line, and
register i2c adapter @ 400khz.
/* 141 = gpio pin */
i2c_boardinfo[0].irq = gpio_to_irq(141);
/* 400 = bus clock rate */
omap_register_i2c_bus(2, 400, i2c_boardinfo,
array_size(i2c_boardinfo));
want make following changes above example -
1. want use gpio pin 15
2. want use equivalent function "omap_register_i2c_bus" in pi's processor [bcm2708 ]
3. not sure need add code [file name , line easy handle]
can please me solve same.
interfacing touch screen pi, same driver in kernel. need initialize of platform data driver work, below have given example code ti's processor other information data sheet below-
platform data
initialise driver, code must added platform initialisation code to
configure i2c address , interrupt (chg) line.
in board files under relevant architecture , platform tree within
linux kernel directory. instance, arch/arm/mach-omap2/.
following structures initialise irq type , i2c address:
static struct mxt_platform_data mxt_data = {
.irqflags = irqf_trigger_falling | irqf_oneshot,
};
static struct i2c_board_info __initdata i2c2boardinfo[] = {
{
i2c_board_info("atmel_mxt_ts", 0x4b), /* i2c address */
.platform_data = &mxt_data,
},
};
these lines added init function initialise gpio chg line, and
register i2c adapter @ 400khz.
/* 141 = gpio pin */
i2c_boardinfo[0].irq = gpio_to_irq(141);
/* 400 = bus clock rate */
omap_register_i2c_bus(2, 400, i2c_boardinfo,
array_size(i2c_boardinfo));
want make following changes above example -
1. want use gpio pin 15
2. want use equivalent function "omap_register_i2c_bus" in pi's processor [bcm2708 ]
3. not sure need add code [file name , line easy handle]
can please me solve same.
for? can't use i2c.1. want use gpio pin 15
why want when there many librarys make using i2c easy. language want use.i want use equivalent function "omap_register_i2c_bus" in pi's processor [bcm2708 ]
use raw i2c peripherals see data sheet, top hit when search "bcm2835-arm-peripherals.pdf"
raspberrypi
Comments
Post a Comment