1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

BMA180: Reset BMA180 chip at reconfiguration.

This commit is contained in:
James Cotton 2011-08-17 06:49:56 -05:00
parent 29026db5d5
commit 11ac0707da
2 changed files with 8 additions and 0 deletions

View File

@ -173,6 +173,11 @@ static int32_t PIOS_BMA180_Config()
0x21 = 0x02 //new_data_int = 1
*/
if(PIOS_BMA180_SetReg(BMA_RESET, BMA_RESET_CODE) < 0)
return -1;
PIOS_DELAY_WaituS(100);
if(PIOS_BMA180_SetReg(BMA_OFFSET_LSB1, 0x81) < 0)
return -1;
if(PIOS_BMA180_SetReg(BMA_GAIN_Y, 0x81) < 0)

View File

@ -44,6 +44,7 @@
#define BMA_Y_LSB_ADDR 0x04
#define BMA_Z_LSB_ADDR 0x06
#define BMA_WE_ADDR 0x0D
#define BMA_RESET 0x10
#define BMA_BW_ADDR 0x20
#define BMA_RANGE_ADDR 0x35
#define BMA_OFFSET_LSB1 0x35
@ -51,6 +52,8 @@
#define BMA_CTRREG3 0x21
#define BMA_CTRREG0 0x0D
#define BMA_RESET_CODE 0x6B
/* Accel range */
#define BMA_RANGE_MASK 0x0E
#define BMA_RANGE_SHIFT 1