Skip to content

Commit

Permalink
beaglebone.c: fix beaglebone i2c bus 2 not existing
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kellner [email protected]
Signed-off-by: Brendan Le Foll <[email protected]>
  • Loading branch information
mkellner authored and arfoll committed May 16, 2016
1 parent 905abde commit d3a2204
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/arm/beaglebone.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ mraa_beaglebone_i2c_init_pre(unsigned int bus)
char* capepath = NULL;
sprintf(devpath, "/dev/i2c-%u", plat->i2c_bus[bus].bus_id);
if (!mraa_file_exist(devpath)) {
syslog(LOG_INFO, "i2c: %s doesn't exist ", devpath);
capepath = mraa_file_unglob(SYSFS_DEVICES_CAPEMGR_SLOTS);
if (capepath == NULL) {
syslog(LOG_ERR, "i2c: Could not find CapeManager");
Expand Down Expand Up @@ -418,7 +419,7 @@ mraa_beaglebone()
else
i2c0_enabled = 0;

if (mraa_file_exist("/sys/class/i2c-dev/i2c-1"))
if (mraa_file_exist("/sys/class/i2c-dev/i2c-2"))
i2c1_enabled = 1;
else
i2c1_enabled = 0;
Expand Down Expand Up @@ -1127,7 +1128,7 @@ mraa_beaglebone()
b->pins[64].i2c.mux_total = 0;
b->pins[64].spi.mux_total = 0;

if (i2c0_enabled == 1) {
if (i2c1_enabled == 1) {
strncpy(b->pins[65].name, "I2C2SCL", MRAA_PIN_NAME_SIZE);
b->pins[65].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
b->pins[65].i2c.mux_total = 0;
Expand All @@ -1140,7 +1141,7 @@ mraa_beaglebone()
b->pins[65].gpio.mux_total = 0;
b->pins[65].i2c.mux_total = 0;

if (i2c0_enabled == 1) {
if (i2c1_enabled == 1) {
strncpy(b->pins[66].name, "I2C2SDA", MRAA_PIN_NAME_SIZE);
b->pins[66].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
b->pins[66].i2c.mux_total = 0;
Expand Down Expand Up @@ -1380,7 +1381,7 @@ mraa_beaglebone()
b->i2c_bus[0].sda = 46 + 18;
b->i2c_bus[0].scl = 46 + 17;

b->i2c_bus[1].bus_id = 1;
b->i2c_bus[1].bus_id = 2;
b->i2c_bus[1].sda = 46 + 20;
b->i2c_bus[1].scl = 46 + 19;

Expand Down

0 comments on commit d3a2204

Please sign in to comment.