diff --git a/baseflight.uvopt b/baseflight.uvopt index d0f789edd..a588256d7 100755 --- a/baseflight.uvopt +++ b/baseflight.uvopt @@ -157,23 +157,6 @@ -UV0168AVR -O238 -S8 -C0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128 -FS08000000 -FL010000 - - - 0 - 0 - 67 - 1 -
134232660
- 0 - 0 - 0 - 0 - 1 - - - \\baseflight\cli.c\67 -
-
0 @@ -191,6 +174,12 @@ 1 cmdline + + 3 + 1 + buf + + @@ -495,7 +484,7 @@ 0 1 - 0 + 1 1 0 0 @@ -509,7 +498,7 @@ 1 - 0 + 2 1 0 0 @@ -523,21 +512,21 @@ 1 - 0 + 3 1 0 0 0 0 - 0 - 0 + 229 + 238 0 .\src\imu.c imu.c 1 - 0 + 4 1 0 0 @@ -551,63 +540,63 @@ 1 - 0 + 5 1 0 0 0 0 - 0 - 0 + 268 + 268 0 .\src\mixer.c mixer.c 1 - 0 + 6 1 0 0 - 0 + 45 0 - 0 - 0 + 55 + 55 0 .\src\mw.c mw.c 1 - 0 + 7 1 0 0 - 0 + 1 0 - 0 - 0 + 264 + 264 0 .\src\sensors.c sensors.c 1 - 0 + 8 1 0 0 0 0 - 0 - 0 + 237 + 237 0 .\src\serial.c serial.c 1 - 0 + 9 5 0 0 @@ -621,7 +610,7 @@ 1 - 0 + 10 5 0 0 @@ -642,7 +631,7 @@ 0 2 - 0 + 11 1 0 0 @@ -656,21 +645,21 @@ 2 - 0 + 12 1 0 0 - 0 + 16 0 - 0 - 0 + 44 + 67 0 .\src\drv_adxl345.c drv_adxl345.c 2 - 0 + 13 1 0 0 @@ -684,7 +673,7 @@ 2 - 0 + 14 1 0 0 @@ -698,21 +687,21 @@ 2 - 0 + 15 1 0 0 - 0 + 43 0 - 0 - 0 + 122 + 149 0 .\src\drv_i2c.c drv_i2c.c 2 - 0 + 16 1 0 0 @@ -726,7 +715,7 @@ 2 - 0 + 17 1 0 0 @@ -740,7 +729,7 @@ 2 - 0 + 18 1 0 0 @@ -754,7 +743,7 @@ 2 - 0 + 19 1 0 0 @@ -775,7 +764,7 @@ 0 3 - 19 + 20 1 0 0 @@ -789,7 +778,7 @@ 3 - 20 + 21 1 0 0 @@ -803,7 +792,7 @@ 3 - 21 + 22 1 0 0 @@ -817,7 +806,7 @@ 3 - 22 + 23 1 0 0 @@ -831,7 +820,7 @@ 3 - 23 + 24 1 0 0 @@ -845,7 +834,7 @@ 3 - 24 + 25 1 0 0 @@ -859,7 +848,7 @@ 3 - 25 + 26 1 0 0 @@ -873,11 +862,11 @@ 3 - 26 + 27 1 0 0 - 34 + 0 0 0 0 @@ -887,7 +876,7 @@ 3 - 27 + 28 1 0 0 @@ -901,7 +890,7 @@ 3 - 28 + 29 1 0 0 @@ -915,7 +904,7 @@ 3 - 29 + 30 1 0 0 @@ -929,11 +918,11 @@ 3 - 30 + 31 1 0 0 - 34 + 0 0 0 0 @@ -943,14 +932,14 @@ 3 - 0 + 32 2 0 0 0 0 - 0 - 0 + 133 + 133 0 .\src\baseflight_startups\startup_stm32f10x_md.s startup_stm32f10x_md.s diff --git a/src/drv_adxl345.c b/src/drv_adxl345.c index c9320742f..c62ea2308 100755 --- a/src/drv_adxl345.c +++ b/src/drv_adxl345.c @@ -49,21 +49,23 @@ void adxl345Init(void) #else // MWC defaults i2cWrite(ADXL345_ADDRESS, ADXL345_POWER_CTL, 1 << 3); // register: Power CTRL -- value: Set measure bit 3 on - // i2cWrite(ADXL345_ADDRESS, ADXL345_DATA_FORMAT, 0x0B); // register: DATA_FORMAT -- value: Set bits 3(full range) and 1 0 on (+/- 16g-range) - // i2cWrite(ADXL345_ADDRESS, ADXL345_BW_RATE, 0x09); // register: BW_RATE -- value: rate=50hz, bw=20hz +#if 1 + i2cWrite(ADXL345_ADDRESS, ADXL345_DATA_FORMAT, 0x0B); // register: DATA_FORMAT -- value: Set bits 3(full range) and 1 0 on (+/- 16g-range) + i2cWrite(ADXL345_ADDRESS, ADXL345_BW_RATE, 0x09); // register: BW_RATE -- value: rate=50hz, bw=20hz +#else + // testing i2cWrite(ADXL345_ADDRESS, ADXL345_DATA_FORMAT, (ADXL_RANGE_8G & 0x03) | ADXL_FULL_RES); // register: DATA_FORMAT -- value: Set bits 3(full range) and 1 0 on (+/- 16g-range) i2cWrite(ADXL345_ADDRESS, ADXL345_BW_RATE, ADXL_RATE_800); // register: BW_RATE -- value: rate=50hz, bw=20hz - - -#endif +#endif +#endif /* FreeFlight */ } void adxl345Read(int16_t *accelData) { - uint8_t buf[6]; + static uint8_t buf[6]; i2cRead(ADXL345_ADDRESS, ADXL345_DATA_OUT, 6, buf); - accelData[0] = buf[1] << 8 | buf[0]; - accelData[1] = buf[3] << 8 | buf[2]; - accelData[2] = buf[5] << 8 | buf[4]; + accelData[0] = buf[0] + (buf[1] << 8); + accelData[1] = buf[2] + (buf[3] << 8); + accelData[2] = buf[4] + (buf[5] << 8); }