Skip to content

Commit

Permalink
Revert "bma020: allow swapping x and y"
Browse files Browse the repository at this point in the history
This reverts commit 4a77e57.
  • Loading branch information
jt1134 committed Dec 23, 2012
1 parent 5fd7278 commit 61483ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
7 changes: 0 additions & 7 deletions drivers/sensor/accel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,4 @@ config ACCEL_BMA020
default y
help
This option enables accelerometer sensors using bma020 driver.

config ACCEL_BMA020_SWAPXY
depends on ACCEL_BMA020
bool "BMA020: Swap X and Y"
default n
help
This option swaps x and y.

14 changes: 2 additions & 12 deletions drivers/sensor/accel/bma020.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,19 +726,11 @@ int bma020_read_accel_xyz(bma020acc_t * acc)

comres = p_bma020->BMA020_BUS_READ_FUNC(p_bma020->dev_addr, ACC_X_LSB__REG, &data[0],6);

#ifdef CONFIG_ACCEL_BMA020_SWAPXY
acc->x = BMA020_GET_BITSLICE(data[0],ACC_X_LSB) | (BMA020_GET_BITSLICE(data[3],ACC_X_MSB)<<ACC_X_LSB__LEN);
#else
acc->x = BMA020_GET_BITSLICE(data[0],ACC_X_LSB) | (BMA020_GET_BITSLICE(data[1],ACC_X_MSB)<<ACC_X_LSB__LEN);
#endif
acc->x = acc->x << (sizeof(short)*8-(ACC_X_LSB__LEN+ACC_X_MSB__LEN));
acc->x = acc->x >> (sizeof(short)*8-(ACC_X_LSB__LEN+ACC_X_MSB__LEN));

#ifdef CONFIG_ACCEL_BMA020_SWAPXY
acc->y = BMA020_GET_BITSLICE(data[2],ACC_Y_LSB) | (BMA020_GET_BITSLICE(data[1],ACC_Y_MSB)<<ACC_Y_LSB__LEN);
#else
acc->y = BMA020_GET_BITSLICE(data[2],ACC_Y_LSB) | (BMA020_GET_BITSLICE(data[3],ACC_Y_MSB)<<ACC_Y_LSB__LEN);
#endif
acc->y = acc->y << (sizeof(short)*8-(ACC_Y_LSB__LEN + ACC_Y_MSB__LEN));
acc->y = acc->y >> (sizeof(short)*8-(ACC_Y_LSB__LEN + ACC_Y_MSB__LEN));

Expand All @@ -750,10 +742,8 @@ int bma020_read_accel_xyz(bma020acc_t * acc)
if (HWREV == 0x9)
acc->x = (-1)*(acc->x);
#endif
//acc->x = (-1)*(acc->x);
#ifndef CONFIG_ACCEL_BMA020_SWAPXY
acc->y = (-1)*(acc->y);
#endif
//acc->x = (-1)*(acc->x);
acc->y = (-1)*(acc->y);
acc->z = (-1)*(acc->z);
return comres;
}
Expand Down

0 comments on commit 61483ab

Please sign in to comment.